Repository navigation
test(webhook): fix envtest cache race behind flaky main CI - #39
Merged
Merged
Conversation
The validators read through the manager's cached client, so a create followed immediately by a conflicting create could race the informer: the second admission didn't yet see the first object (or, for role bindings, the referenced KafkaCluster) and was wrongly admitted. This made TestEnvtestRBWebhook_IdentityCollision_Rejected flaky on main. Wrap the envtest client so Create returns only once the manager cache observes the new object.
1 of 2 tasks
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.
Summary
cion main failed inTestEnvtestRBWebhook_IdentityCollision_Rejectedafter build(deps): bump github.com/twmb/franz-go/pkg/kmsg from 1.15.0 to 1.15.1 #37 merged; onlygo.mod/go.sumchanged, so this is a test race, not a dependency regression.KafkaCluster, which the validator treats as "allow" — so the duplicate was admitted.cacheSyncedClient) soCreatereturns only once the manager cache observes the object. Applied to all five webhook envtest environments; production code unchanged.Test plan
go test -tags envtest -count=3 ./internal/operator/webhook/(WSL, envtest 1.37.0): all tests pass in all 3 runsenvtestjob green