Skip to content

Commit

Permalink
Fix test assertion for duplicate events
Browse files Browse the repository at this point in the history
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 <jkulikau@redhat.com>
(cherry picked from commit 906dcff)
  • Loading branch information
JustinKuli committed Apr 21, 2023
1 parent e88d76f commit 8a87b21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/e2e/case17_gatekeeper_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 8a87b21

Please sign in to comment.