Skip to content

Fix e2e-aws flake cascade and metrics-pod connection race - #1005

Closed
parametalol wants to merge 2 commits into
openshift:masterfrom
parametalol:fix-e2e-aws-flake-cascade
Closed

Fix e2e-aws flake cascade and metrics-pod connection race#1005
parametalol wants to merge 2 commits into
openshift:masterfrom
parametalol:fix-e2e-aws-flake-cascade

Conversation

@parametalol

Copy link
Copy Markdown

Summary

PRs #1003 and #1004 both failed e2e-aws despite neither touching e2e tests, RBAC, or the metrics endpoint. Both failed for the same underlying reason:

  • tests/framework/resource.go: InitializeClusterResources hard-fails if a cluster-scoped RBAC object (the file-integrity-operator ClusterRole/ClusterRoleBinding) already exists. Since E2E_SKIP_CLEANUP_ON_ERROR defaults to true, one failing test leaves these behind, and every subsequent test in the serial run then fails immediately at setup instead of just the one that actually broke. createFromYAML already supports skipIfExists for exactly this; the only caller just never used it. This PR flips it to true.
  • tests/e2e/helpers.go: runOCandGetOutput (used to curl the metrics endpoint from an ephemeral pod) fails the test on the very first error. In practice curl exit 7 ("connection refused") happens routinely while the metrics service is still coming up — it shows up 11 times in a fully passing run I checked, just non-fatally, because that other call site already retries via a wait.Poll loop. This PR adds the same tolerance (retry a few times, 5s apart) directly in runOCandGetOutput so the ~10 tests that go through it aren't one-shot.

Together these mean a single transient hiccup stays isolated to (at most) one test instead of taking down the rest of the suite.

Test plan

  • go build ./tests/...
  • go vet ./tests/...
  • e2e-aws Prow job passes (can't run locally — requires a live OpenShift cluster)

🤖 Generated with Claude Code

InitializeClusterResources hard-failed if a cluster-scoped RBAC object
(e.g. the file-integrity-operator ClusterRole) already existed, which
happened whenever a prior test failed and E2E_SKIP_CLEANUP_ON_ERROR left
it behind. That turned one failing test into every remaining test in the
serial run failing at setup. Pass skipIfExists=true, which createFromYAML
already supports, so setup tolerates a leaked object instead.

Separately, runOCandGetOutput (used to curl the metrics endpoint from an
ephemeral pod) failed the test on the first error, but curl exit 7
("connection refused") happens routinely while the metrics service is
still coming up -- the codebase already tolerates this elsewhere via a
wait.Poll retry loop. Add the same tolerance directly in
runOCandGetOutput: retry a few times before failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: parametalol
Once this PR has been reviewed and has the lgtm label, please assign rhmdnd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 27, 2026
@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Hi @parametalol. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 kubernetes-sigs/prow repository.

@Anna-Koudelkova

Copy link
Copy Markdown

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 27, 2026
The first fix (skipIfExists=true) avoided the hard "already exists"
failure, but silently left a leaked ClusterRole/ClusterRoleBinding
bound to a deleted namespace's ServiceAccount in place. On the live
e2e-aws run, this meant the *next* test's operator had no working
cluster-scoped RBAC, so instead of failing fast it timed out after
~30 minutes waiting for a DaemonSet that could never be created.

createOrReplace now deletes and recreates a conflicting object so it's
rebound to the current test's namespace, and InitializeClusterResources
uses that behavior. The one other caller (global CRD setup in
framework.go, run once per test binary) keeps the original skip
behavior, since deleting a CRD would cascade-delete every custom
resource of that type.

Also widen runOCandGetOutput's retry window from 3 attempts/5s to the
same pollInterval/pollTimeout used by getMetricResultsSupressWarning
for the identical "metrics endpoint not ready yet" condition: the
smaller window was not enough on a live run (TestMetricsHTTPVersion
still failed after exhausting it).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@abushkin-redhat

Copy link
Copy Markdown

Hi Michaël,

The PR looks good. /lgtm

@abushkin-redhat

Copy link
Copy Markdown

/ok-to-test

@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@parametalol: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws 7e59dc7 link true /test e2e-aws

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants