diff --git a/test/e2e/condition_matcher_test.go b/test/e2e/condition_matcher_test.go index 8f2865554..ba9940b2e 100644 --- a/test/e2e/condition_matcher_test.go +++ b/test/e2e/condition_matcher_test.go @@ -53,7 +53,9 @@ func (m *ConditionMatcher) Matches(conditions []opv1.OperatorCondition) bool { } if m.MatchesType(&cond) && !m.MatchesStatus(&cond) { - return false + if !m.Any { + return false + } } } diff --git a/test/e2e/condition_matcher_unit_test.go b/test/e2e/condition_matcher_unit_test.go index d88ea3b72..6d511ddf9 100644 --- a/test/e2e/condition_matcher_unit_test.go +++ b/test/e2e/condition_matcher_unit_test.go @@ -101,6 +101,20 @@ func TestVerifyOperatorStatusCondition(t *testing.T) { expectError: true, errorContains: "context deadline exceeded", }, + { + name: "Any mode succeeds when matching condition appears after non-matching one", + expectedConditions: map[string]opv1.ConditionStatus{ + "Degraded": opv1.ConditionTrue, + }, + initialObjects: []runtime.Object{ + newCertManagerObjectWithConditions( + opv1.OperatorCondition{Type: controllerPrefix + "-static-resources-Degraded", Status: opv1.ConditionFalse}, + opv1.OperatorCondition{Type: controllerPrefix + "Degraded", Status: opv1.ConditionTrue}, + ), + }, + matchAny: true, + expectError: false, + }, { name: "A missing condition for Progressing", expectedConditions: map[string]opv1.ConditionStatus{