From 906dcffd4704c872e1ef57a07b34e0403f875191 Mon Sep 17 00:00:00 2001 From: Justin Kulikauskas Date: Thu, 20 Apr 2023 16:15:35 -0400 Subject: [PATCH] Fix test assertion for duplicate events The test is meant to ensure that the gatekeeper-sync is not emitting the same event multiple times in a row. But the assertion was failing sometimes because of duplicate events from template-errors. Those will sometimes occur during normal (correct) operation of the template-sync. Signed-off-by: Justin Kulikauskas --- test/e2e/case17_gatekeeper_sync_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/case17_gatekeeper_sync_test.go b/test/e2e/case17_gatekeeper_sync_test.go index fdb52d0a..cefe9328 100644 --- a/test/e2e/case17_gatekeeper_sync_test.go +++ b/test/e2e/case17_gatekeeper_sync_test.go @@ -297,9 +297,9 @@ var _ = Describe("Test Gatekeeper ConstraintTemplate and constraint sync", Order fmt.Sprintf("Got %s but expected one of %v", history[0].Message, validMsgs), ) - // Verify that there are no duplicate status messages. + // Verify that there are no duplicate gatekeeper status messages. for i, historyEvent := range managedPolicy.Status.Details[1].History { - if i == 0 || strings.HasPrefix(historyEvent.Message, "NonCompliant; template-error;") { + if i == 0 || strings.Contains(historyEvent.Message, "NonCompliant; template-error;") { continue }