secret tests: disable git auto-maintenance so cleanup cannot race it #209
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!209
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/secret-test-fixture-gc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
allodpackage failed to build on the host because one of its own tests is flaky, not because the command is wrong:nixos-rebuildon nexus stopped atTestSecretCreateRendersEachDeclaredValueShapewithTempDir RemoveAll cleanup: ... .git/objects/pack: directory not empty. Aftergit commit, git starts a detachedmaintenance run --autothat takes a lock under.git/objectsand may write pack files while the test's temporary directory is already being deleted. The fixtures hadgc.auto=0, which stops the collection but not the detached process. This PR setsmaintenance.auto=false(plusgc.auto=0andgc.autoDetach=false) for every git the fixtures and the command under test spawn, through the environment and in the fixture repositories. Test-only change; no command behavior changes. Proof: the failing test reproduced once in 25 runs before the change and passed 60 consecutive runs after it, and the full tagged suite passed five times over. If it is wrong, revert it; the flake returns and nothing else changes.What changes
cmd/allod/secret_test.go: agitNoMaintenanceEnvvariable (GIT_CONFIG_COUNTkeys formaintenance.auto=false,gc.auto=0,gc.autoDetach=false) appended togitRun's environment and set in the test process environment bynewSecretFixture, so the command's owngit commitandgit pushinherit it; both fixture repositories also setmaintenance.auto=falsein their config.cmd/allod/*.gothat ships changes.Risk
R1. Test-only; the packaged check and the tagged suite are the witnesses.
Validation
go test -tags secret -run TestSecretCreateRendersEachDeclaredValueShape -count=25failed once withTempDir RemoveAll cleanup: unlinkat .../secrets/.git: directory not empty.TestSecretRotateRendersEachDeclaredValueShapeandTestSecretCreateLandsPendingEntryat-count=60:ok forge.anarch.diy/allod/tools/cmd/allod 43.981s.go test -tags site,secret -count=5 ./cmd/allod:ok forge.anarch.diy/allod/tools/cmd/allod 38.357s, exit 0nix build .#checks.x86_64-linux.go-checks,git diff --check): every command exit 0;nix buildbuiltallod-tools-go-checks,gofmtandgit diff --checkprinted nothingRefs allod/secrets#23