CNF-26150: Fix flaky e2e ConditionMatcher.Matches early-return when Any mode is true - #464
CNF-26150: Fix flaky e2e ConditionMatcher.Matches early-return when Any mode is true#464sebrandon1 wants to merge 1 commit into
Conversation
When Any is true, the Matches function should return true if at least one condition matching the type pattern has the expected status. However, the early-return on status mismatch fires before checking all conditions, causing false negatives when a non-matching condition appears before a matching one in the iteration order. This produces flaky e2e failures in overrides tests because the API returns conditions in non-deterministic order: if the static-resources Degraded=False condition is iterated before the deployment Degraded=True condition, the matcher incorrectly returns false. Guard the early-return with !m.Any so that Any mode continues searching for at least one match instead of short-circuiting on the first mismatch.
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@sebrandon1: This pull request explicitly references no jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughThe condition matcher now ignores a status mismatch in match-any mode and continues evaluating conditions. An end-to-end test verifies that a later matching condition succeeds after an earlier mismatch. ChangesCondition matching
Estimated code review effort: 2 (Simple) | ~5 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sebrandon1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@sebrandon1: This pull request references CNF-26150 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@sebrandon1: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
ConditionMatcher.Matches()where the early-return on status mismatch fires even whenAny=true, causing false negatives when a non-matching condition is iterated before a matching oneProblem
The
Matchesfunction short-circuits withreturn falsewhen it finds a condition that matches the type pattern but not the expected status. This is correct forAllmode but wrong forAnymode —Anyshould keep looking for at least one match.Since the Kubernetes API returns conditions in non-deterministic order, this produces flaky e2e failures in the overrides tests. The
e2e-operator-tech-previewjob fails whencert-manager-webhook-static-resources-Degraded(False) is iterated beforecert-manager-webhook-deploymentDegraded(True).Fix
Guard the early-return with
!m.AnysoAnymode continues searching instead of short-circuiting on the first mismatch.Test plan
TestVerifyOperatorStatusConditionpasses (5 cases, 360s)Summary by CodeRabbit
Bug Fixes
Tests