test: stabilize customresourcesgate TestReconcile [release-2.1 backport]#978
Merged
phisco merged 1 commit intocrossplane:release-2.1from Apr 17, 2026
Conversation
The TestReconcile subtests normalized recorded gate calls by sorting only on GVK.Kind. Several fixtures contain multiple GVKs with identical Kind but different Version (e.g. "TestResource" at v1alpha1 and v1beta1). Combined with the nondeterministic map iteration in the reconciler, this made the assertion order-dependent and the test intermittently flaky (notably TestReconcile/EstablishedCRDCallsGateTrue). Sort on the full GroupVersionKind (Group, Version, Kind) so the comparison is stable regardless of the reconciler's iteration order. This mirrors the fix already on main (552d14c), backported here for release-2.0. Signed-off-by: Philippe Scorsolini <5697904+phisco@users.noreply.github.com>
lsviben
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports the flaky-test fix from
main(originally part of 552d14c, "Upgrade controller-runtime to v0.21.0") torelease-2.1.The normaliser in
TestReconcilesorted recordedgate.True/gate.Falsecalls byKindonly. TheEstablishedCRDCallsGateTruefixture contains two GVKs with identicalKind="TestResource"differing only inVersion, so the sort could not disambiguate them — combined with the reconciler's nondeterministicmap[schema.GroupVersionKind]booliteration, the assertion was order-dependent and flaked intermittently in CI (also flaked on unrelated runs before the current security-bump PRs).Replaces the comparator with a full GVK sort (Group, Version, Kind), matching what
mainandrelease-2.2already have.Test plan