Skip to content

🌱 Fix flaky test in extensionconfig_controller_test.go #12386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Okabe-Junya
Copy link
Member

@Okabe-Junya Okabe-Junya commented Jun 22, 2025

What this PR does

Fixed a flaky test - TestExtensionReconciler_Reconcile by adding proper sync to wait for both Paused and Discovery conditions to be set before performing assertions

why we need it

The paused.EnsurePausedCondition() function triggers multiple reconciliation cycles:

  1. Sets PausedV1Beta2Condition and returns requeue=true (early return)
  2. Executes discovery logic and sets ExtensionConfigDiscoveredV1Beta2Condition

The test assertion g.Expect(v1beta2Conditions).To(HaveLen(2)) was executed immediately after the second reconcile call, but before the patch containing the Discovery condition was fully applied to the API server (race condition I think).

So we need to Eventually block to resolve this race condition

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #12311

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 22, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 22, 2025
@Okabe-Junya
Copy link
Member Author

/test all

@Okabe-Junya
Copy link
Member Author

/area ci
/area testing

@k8s-ci-robot k8s-ci-robot added area/ci Issues or PRs related to ci area/testing Issues or PRs related to testing and removed do-not-merge/needs-area PR is missing an area label labels Jun 22, 2025
@Okabe-Junya
Copy link
Member Author

/retitle 🌱 Fix flaky test in extensionconfig_controller_test.go

@k8s-ci-robot k8s-ci-robot changed the title Fix flaky test in extensionconfig_controller_test.go 🌱 Fix flaky test in extensionconfig_controller_test.go Jun 22, 2025
@Okabe-Junya Okabe-Junya force-pushed the fix-12311 branch 2 times, most recently from e449861 to 3b952de Compare June 22, 2025 15:16
@mboersma
Copy link
Contributor

I think this attempts to fix #12311.

@Okabe-Junya
Copy link
Member Author

I think this attempts to fix #12311.

Yes, I couldn't find time to resolve the CI error.
I'll check it out for now. Once CI passes, I'll mark the PR as ready for review and link it to the issue :)

@Okabe-Junya Okabe-Junya force-pushed the fix-12311 branch 2 times, most recently from c9439f8 to d9e44b7 Compare June 24, 2025 15:32
@Okabe-Junya
Copy link
Member Author

Still occurring a CI error, but I'm not sure of the cause.
The method seems to be implemented, and running make lint locally doesn't detect any errors. It appears to be a problem with type inference, but I haven't pin-pointed the exact cause yet...

 Error: exp/runtime/internal/controllers/extensionconfig_controller_test.go:131:39: updatedConfig.GetV1Beta2Conditions undefined (type *"sigs.k8s.io/cluster-api/api/runtime/v1beta2".ExtensionConfig has no field or method GetV1Beta2Conditions) (typecheck)

@sbueringer
Copy link
Member

Did you already rebase on top of main? CI is running based on latest main + the PR

@Okabe-Junya
Copy link
Member Author

Did you already rebase on top of main? CI is running based on latest main + the PR

Yes, already rebase with fresh main...
(Will take a look this error in this weekend 🙇 )

@sbueringer
Copy link
Member

sbueringer commented Jun 26, 2025

Yes, already rebase with fresh main...

I think something went wrong there (see 26.03.2025)

image

@Okabe-Junya Okabe-Junya marked this pull request as ready for review June 27, 2025 15:08
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2025
@k8s-ci-robot k8s-ci-robot requested a review from enxebre June 27, 2025 15:08
@Okabe-Junya
Copy link
Member Author

I think something went wrong there (see 26.03.2025)

Oh, I'm really sorry...

I had mistakenly set up the upstream configuration on my machine (just for this repo), and origin/main wasn't fetching correctly for a while.
It seems I've been working off an old main branch... 🙇

I've rebased on the latest main now. All CIs seems to be working well :)
Could you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Issues or PRs related to ci area/testing Issues or PRs related to testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[unit test] Timed out after 10.001s.
4 participants