Repository navigation
Fix install-apply integration test orphaned by #15's same-uid retry - #18
Merged
Merged
Conversation
PR #15 ("Retry install's conditional SSA apply when its own controllers win the race") narrowed ssaApply's fail-closed behavior: a bare resourceVersion conflict whose re-read still shows the approved uid is a benign race — the object's own controller writing a status/finalizer in the apply window — so the apply re-reads and retries on the current resourceVersion instead of aborting the install. A uid CHANGE (replacement) or disappearance still fails closed. TestApplyPreparedRefusesUpdateAfterPrepare was left asserting the old contract: that ANY intervening update, even same-uid, must make ApplyPrepared error. Under #15's code the apply retries and succeeds, so require.Error now fails — the integration suite has been red on main since #15 merged, and on every branch based on it. Rewrite it as the real-apiserver analog of #15's fake-client TestInstall_ControllerWriteBetweenCreateAndApply_RetriesOnCurrentVersion: a same-uid intervening update must retry to success, land the install's desired spec, and leave a field owned by another manager untouched. The replacement/disappearance fail-closed siblings are unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
What
mage test:integrationhas been red onmainsince #15 merged. The failing test isTestApplyPreparedRefusesUpdateAfterPrepareinpkg/platform/oap/install— and it fails deterministically, not as a flake.Why
#15 ("Retry install's conditional SSA apply when its own controllers win the race") intentionally narrowed
ssaApply's fail-closed behavior. A bare resourceVersion conflict whose re-read still shows the same uid is a benign race — the object's own controller writing a status/finalizer in the apply window — so the apply now re-reads and retries on the current resourceVersion instead of aborting the whole install. A uid change (same-name replacement) or the object's disappearance still fails closed.#15 added fake-client tests for the new behavior but left
TestApplyPreparedRefusesUpdateAfterPrepareasserting the old contract: that any intervening update — even same-uid — must makeApplyPreparedreturn an error. Under #15's code the apply retries and succeeds, sorequire.Errornow fails every run.Because this lives in
//go:build integration(whichgo test ./.../mage test:unitskip), the break was invisible to the unit gate and only surfaces in CI's integration job — exactly the gap called out in the repo conventions.The fix
Rewrite the test as the real-apiserver analog of #15's fake-client
TestInstall_ControllerWriteBetweenCreateAndApply_RetriesOnCurrentVersion: a same-uid intervening update must retry to success, land the install's desired spec, and leave a field owned by another field manager untouched. The replacement / disappearance fail-closed siblings (TestApplyPreparedRefusesReplacementAfterPrepare,TestApplyPreparedRefusesDisappearedApprovedObject,TestApplyPreparedRefusesReplacementBetweenCreateAndSSA) are unchanged.Verification
Reproduced the failure in isolation first, then confirmed the rewritten test plus all three fail-closed siblings pass under
go test -race -tags=integrationagainst envtest. Test-only change; no production code touched.