Skip to content

Commit 57ebda2

Browse files
Loosen some event duplication test requirements
With the template-sync now reconciling more often (there are no longer any cases where the reconcile can be skipped), some event duplication might be unavoidable. Signed-off-by: Justin Kulikauskas <[email protected]>
1 parent 8c434ad commit 57ebda2

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

test/e2e/case10_error_test.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ var _ = Describe("Test error handling", func() {
138138
err := runtime.DefaultUnstructuredConverter.FromUnstructured(hubPlc.Object, &plc)
139139
g.Expect(err).ToNot(HaveOccurred())
140140
g.Expect(plc.Status.Details).To(HaveLen(1))
141-
g.Expect(plc.Status.Details[0].History).To(HaveLen(1))
141+
g.Expect(plc.Status.Details[0].History).To(Or(HaveLen(1), HaveLen(2)))
142142
g.Expect(plc.Status.Details[0].TemplateMeta.GetName()).To(Equal("case10_invalid-name"))
143143
g.Expect(plc.Status.Details[0].History[0].Message).To(ContainSubstring(statusMsg))
144144
}, defaultTimeoutSeconds, 1).Should(Succeed())
@@ -353,26 +353,20 @@ var _ = Describe("Test error handling", func() {
353353
1,
354354
).Should(BeTrue())
355355
})
356-
It("should only generate one event for a missing kind", func() {
356+
It("should only generate a limited number of events for a missing kind", func() {
357357
policyName := "case10-missing-kind"
358358
hubApplyPolicy(policyName,
359359
yamlBasePath+"missing-kind.yaml")
360360

361361
By("Checking for the error event and ensuring it only occurs once")
362362
Eventually(
363-
checkForEvent(
364-
policyName, "Object 'Kind' is missing in",
365-
),
366-
defaultTimeoutSeconds,
367-
1,
363+
checkForEvent(policyName, "Object 'Kind' is missing in"), defaultTimeoutSeconds, 1,
368364
).Should(BeTrue())
369365
Consistently(
370-
getMatchingEvents(
371-
policyName, "Object 'Kind' is missing in",
372-
),
373-
defaultTimeoutSeconds,
374-
1,
375-
).Should(HaveLen(2))
366+
getMatchingEvents(policyName, "Object 'Kind' is missing in"), defaultTimeoutSeconds, 1,
367+
// Some duplication might be unavoidable,
368+
// but note that one of the matching events here is *not* a compliance event
369+
).Should(Or(HaveLen(2), HaveLen(3)))
376370
})
377371
})
378372

0 commit comments

Comments
 (0)