Skip to content

Commit 9382df7

Browse files
dhaiducekopenshift-ci[bot]
authored andcommitted
Move status check to Eventually()
There wasn't enough time for the status to populate, so `Eventually()` should allow retries and prevent a flake. Signed-off-by: Dale Haiducek <[email protected]>
1 parent f8cbf8e commit 9382df7

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

test/e2e/case10_error_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,22 @@ var _ = Describe("Test error handling", func() {
126126
1,
127127
).Should(BeTrue())
128128
By("Checking if policy status is noncompliant")
129-
hubPlc := utils.GetWithTimeout(
130-
clientHubDynamic,
131-
gvrPolicy,
132-
policyName,
133-
clusterNamespaceOnHub,
134-
true,
135-
defaultTimeoutSeconds)
136-
var plc *policiesv1.Policy
137-
err := runtime.DefaultUnstructuredConverter.FromUnstructured(hubPlc.Object, &plc)
138-
Expect(err).ToNot(HaveOccurred())
139-
Expect(plc.Status.Details).To(HaveLen(1))
140-
Expect(plc.Status.Details[0].History).To(HaveLen(1))
141-
Expect(plc.Status.Details[0].TemplateMeta.GetName()).To(Equal("case10_invalid-name"))
142-
Expect(plc.Status.Details[0].History[0].Message).To(ContainSubstring(statusMsg))
129+
Eventually(func(g Gomega) {
130+
hubPlc := utils.GetWithTimeout(
131+
clientHubDynamic,
132+
gvrPolicy,
133+
policyName,
134+
clusterNamespaceOnHub,
135+
true,
136+
defaultTimeoutSeconds)
137+
var plc *policiesv1.Policy
138+
err := runtime.DefaultUnstructuredConverter.FromUnstructured(hubPlc.Object, &plc)
139+
g.Expect(err).ToNot(HaveOccurred())
140+
g.Expect(plc.Status.Details).To(HaveLen(1))
141+
g.Expect(plc.Status.Details[0].History).To(HaveLen(1))
142+
g.Expect(plc.Status.Details[0].TemplateMeta.GetName()).To(Equal("case10_invalid-name"))
143+
g.Expect(plc.Status.Details[0].History[0].Message).To(ContainSubstring(statusMsg))
144+
}, defaultTimeoutSeconds, 1).Should(Succeed())
143145
})
144146
It("should generate unsupported object err event", func() {
145147
hubApplyPolicy("case10-unsupported-object",

0 commit comments

Comments
 (0)