Skip to content

Commit

Permalink
Move status check to Eventually()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dhaiducek authored and openshift-ci[bot] committed Oct 5, 2023
1 parent f8cbf8e commit 9382df7
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions test/e2e/case10_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,22 @@ var _ = Describe("Test error handling", func() {
1,
).Should(BeTrue())
By("Checking if policy status is noncompliant")
hubPlc := utils.GetWithTimeout(
clientHubDynamic,
gvrPolicy,
policyName,
clusterNamespaceOnHub,
true,
defaultTimeoutSeconds)
var plc *policiesv1.Policy
err := runtime.DefaultUnstructuredConverter.FromUnstructured(hubPlc.Object, &plc)
Expect(err).ToNot(HaveOccurred())
Expect(plc.Status.Details).To(HaveLen(1))
Expect(plc.Status.Details[0].History).To(HaveLen(1))
Expect(plc.Status.Details[0].TemplateMeta.GetName()).To(Equal("case10_invalid-name"))
Expect(plc.Status.Details[0].History[0].Message).To(ContainSubstring(statusMsg))
Eventually(func(g Gomega) {
hubPlc := utils.GetWithTimeout(
clientHubDynamic,
gvrPolicy,
policyName,
clusterNamespaceOnHub,
true,
defaultTimeoutSeconds)
var plc *policiesv1.Policy
err := runtime.DefaultUnstructuredConverter.FromUnstructured(hubPlc.Object, &plc)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(plc.Status.Details).To(HaveLen(1))
g.Expect(plc.Status.Details[0].History).To(HaveLen(1))
g.Expect(plc.Status.Details[0].TemplateMeta.GetName()).To(Equal("case10_invalid-name"))
g.Expect(plc.Status.Details[0].History[0].Message).To(ContainSubstring(statusMsg))
}, defaultTimeoutSeconds, 1).Should(Succeed())
})
It("should generate unsupported object err event", func() {
hubApplyPolicy("case10-unsupported-object",
Expand Down

0 comments on commit 9382df7

Please sign in to comment.