Make rotate-token's test runner enforce every assertion #49
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/nexus!49
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/rotate-token-enforcing-runner"
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
rotate-tokentest suite now enforces every assertion in every test. Until now the runner called each test inside anif, and bash suspends stop-on-error inside anifcondition, so a failed check in the middle of a test was ignored and only the last line of each test decided its result. Nothing changes for a running machine:scripts/rotate-tokenis untouched and onlytests/rotate-token.shchanges. Turning enforcement on exposed six tests whose middle assertions were wrong, all on the test side: two matched a command name against the script's explanatory prose instead of the command line, two shared a fixture secret path across two groups so the script refused the ambiguity before reaching the branch under test, and two ran without the hostname a later fixture change had made necessary. Each is corrected with a comment saying why. Assertions on prompt text were removed, sinceread -pprints nothing when stdin is a pipe, so they could never fail; the one that carried a real property was reshaped to observe the effect instead. The suite passes, theprovisioning-contractflake check passes, and sabotaging one middle assertion now fails the suite, which it could not before. If this is wrong it shows as the suite going red on behaviour that is in fact correct; each correction is one hunk to revert.Closes allod/nexus#48. Closes allod/nexus#46.
What changed
run_testruns the test in a subshell that sets-eitself and reads the status as a plain statement, outside anyifor||.git pushstep anchor in the two continuity tests; a dedicated fixture secret for the mixed-format group sosecrets/git-a.agebelongs to one group again (this also restored the allow-single-secret dry-run test);ROTATE_TOKEN_HOSTNAMEand a local-auth root for the two malformed-plaintext tests whose fixtures had gained a refresh entry.Paste newassertion; the shared-group test instead feeds a second stdin line and asserts it never lands in a rewritten secret, which is the property the prompt-count assertion was after.|| return 1guards; they are redundant under the new runner and harmless.No defect in
scripts/rotate-tokenwas found; every failure traced to the test or fixture side.Risk
R1. A corrected assertion could now pin something narrower than the original intent; each correction carries its reasoning in a comment for review. The script's behaviour is unchanged, so no host rotates differently.
Validation
bash tests/rotate-token.sh: 36 tests pass, re-run by the integrator on the final commit.nix build .#checks.x86_64-linux.provisioning-contractpasses;shellcheck -xon the test file is clean.set -euo pipefail), and its command-substitution point is the standing bash exemption documented in shell.md, unchanged by this PR.Labels are unavailable to this token; none is warranted.