Skip to content

Commit 9c5e517

Browse files
committed
Add round of feedback
1 parent 599b42a commit 9c5e517

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

tests/suite/nginxgateway_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,22 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
122122
return false
123123
}
124124

125-
return verifyNginxGatewayStatus(ng, int64(1)) != nil
125+
return verifyNginxGatewayStatus(ng, int64(1)) == nil
126126
}).WithTimeout(timeoutConfig.UpdateTimeout).
127127
WithPolling(500 * time.Millisecond).
128128
Should(BeTrue())
129129
})
130130

131131
When("testing NGF on startup", func() {
132132
When("log level is set to debug", func() {
133-
It("outputs debug logs and the status is accepted and true", func() {
133+
It("outputs debug logs and the status is valid", func() {
134134
ngfPodName, err := getNGFPodName()
135135
Expect(err).ToNot(HaveOccurred())
136136

137137
ng, err := getNginxGateway(nginxGatewayNsname)
138138
Expect(err).ToNot(HaveOccurred())
139139

140-
gen, err := getNginxGatewayCurrentObservedGeneration(ng)
141-
Expect(err).ToNot(HaveOccurred())
142-
143-
Expect(verifyNginxGatewayStatus(ng, gen)).To(Succeed())
140+
Expect(verifyNginxGatewayStatus(ng, int64(1))).To(Succeed())
144141

145142
Eventually(
146143
func() bool {
@@ -159,7 +156,7 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
159156
})
160157

161158
When("default log level is used", func() {
162-
It("only outputs info logs and the status is accepted and true", func() {
159+
It("only outputs info logs and the status is valid", func() {
163160
teardown(releaseName)
164161

165162
cfg := getDefaultSetupCfg()
@@ -169,12 +166,19 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
169166
ngfPodName, err := getNGFPodName()
170167
Expect(err).ToNot(HaveOccurred())
171168

172-
ng, err := getNginxGateway(nginxGatewayNsname)
173-
Expect(err).ToNot(HaveOccurred())
169+
Eventually(
170+
func() bool {
171+
ng, err := getNginxGateway(nginxGatewayNsname)
172+
if err != nil {
173+
return false
174+
}
174175

175-
Expect(verifyNginxGatewayStatus(ng, int64(1))).To(Succeed())
176+
return verifyNginxGatewayStatus(ng, int64(1)) == nil
177+
}).WithTimeout(timeoutConfig.UpdateTimeout).
178+
WithPolling(500 * time.Millisecond).
179+
Should(BeTrue())
176180

177-
Eventually(
181+
Consistently(
178182
func() bool {
179183
logs, err := resourceManager.GetPodLogs(ngfNamespace, ngfPodName, &core.PodLogOptions{
180184
Container: "nginx-gateway",
@@ -199,8 +203,7 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
199203
})
200204

201205
When("NginxGateway is updated", func() {
202-
It("captures the change, the status is accepted and true,"+
203-
" and the observed generation is incremented", func() {
206+
It("captures the change, the status is valid, and the observed generation is incremented", func() {
204207
// previous test has left the log level at info, this test will change the log level to debug
205208
ng, err := getNginxGateway(nginxGatewayNsname)
206209
Expect(err).ToNot(HaveOccurred())
@@ -226,7 +229,7 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
226229
return false
227230
}
228231

229-
return verifyNginxGatewayStatus(ng, gen+1) != nil
232+
return verifyNginxGatewayStatus(ng, gen+1) == nil
230233
}).WithTimeout(timeoutConfig.UpdateTimeout).
231234
WithPolling(500 * time.Millisecond).
232235
Should(BeTrue())
@@ -255,11 +258,7 @@ var _ = Describe("NginxGateway", Ordered, Label("functional", "nginxGateway"), f
255258
Eventually(
256259
func() error {
257260
_, err := getNginxGateway(nginxGatewayNsname)
258-
if err != nil {
259-
return err
260-
}
261-
262-
return nil
261+
return err
263262
}).WithTimeout(timeoutConfig.DeleteTimeout).
264263
WithPolling(500 * time.Millisecond).
265264
Should(MatchError(ContainSubstring("failed to get nginxGateway")))

0 commit comments

Comments
 (0)