Skip to content

refs: the Vault tests no longer race on VAULT_TOKEN - #293

Open
Moep90 wants to merge 1 commit into
kapicorp:mainfrom
Moep90:fix/vault-test-env-race
Open

Moep90 wants to merge 1 commit into
kapicorp:mainfrom
Moep90:fix/vault-test-env-race

Conversation

@Moep90

@Moep90 Moep90 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #272, which closed when main was force-pushed. Same commits, replayed onto the new main.

refs::vault::tests::kv_and_transit_round_trip_against_a_mock_server failed on #290, which changes only docs:

panicked at crates/krab-compile/src/refs/vault.rs:714:52:
called `Result::unwrap_err()` on an `Ok` value: "647272"

That test sets VAULT_TOKEN=bad and expects the reveal to fail with an authentication error. tls_is_verified_unless_skip_verify_is_explicit, which I added in #238, sets VAULT_TOKEN=s.token. Both tests are in the same binary, so they run in parallel threads. When the second one sets the variable in between, the reveal succeeds and the first test fails. The SAFETY comment on #238's test assumed every test sets a usable token, which this one doesn't.

Both tests now hold a Mutex in the test module while they use the variable. They are the only set_var("VAULT_TOKEN") calls in the crate. No code outside the tests changes.

I could not reproduce the failure locally: 30 runs of cargo test -p krab-compile --lib refs::vault passed before the change. The evidence is the CI log above and the two writes to one process-wide variable. With the change, cargo fmt --check, clippy with warnings denied, and cargo test -p krab-compile --lib refs (13 tests) pass.

kv_and_transit_round_trip_against_a_mock_server sets a wrong token to check the authentication error. tls_is_verified_unless_skip_verify_is_explicit, added in kapicorp#238, sets a valid one in a parallel thread, so the reveal can succeed and the first test fails. Both now hold one lock while they use the variable.

Signed-off-by: moep90 <3042152+Moep90@users.noreply.github.com>
@github-actions github-actions Bot added the area: compile Compile, input and output types, manifest label Oct 29, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 16, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 16, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 16, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 16, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 17, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 17, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 17, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 18, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 18, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 18, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 19, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 19, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 19, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 20, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 20, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 20, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 20, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 21, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 21, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 21, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 22, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 22, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 22, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 22, 2026
kadet-hub-kapitan-next Bot pushed a commit to kadet-hub/krab that referenced this pull request Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compile Compile, input and output types, manifest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant