Skip to content

tests: wait for the trust file instead of reading it the moment trust appears - #508

Merged
TeoSlayer merged 1 commit into
mainfrom
tests/deflake-trust-file
Oct 7, 2026
Merged

TeoSlayer merged 1 commit into
mainfrom
tests/deflake-trust-file

Conversation

@TeoSlayer

@TeoSlayer TeoSlayer commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

What fails

TestHandshakeTrustLoadVerify and TestHandshakeTrustPersistence fail intermittently when the machine is busy. Before #500 they read trust.json the moment the peer showed as trusted:

zz_handshake_test.go:620: read trust file: open .../trust.json: no such file or directory
zz_handshake_test.go:490: trust store not created: stat .../trust.json: no such file or directory

#500 (merged) made both wait up to 2 s for the file to exist. That leaves one gap: the handshake manager writes the file from a goroutine after the in-memory state changes, and its first write can still contain only the pending request. LoadVerify can then read a file with no trusted peer and fail with "trust file should have at least one trusted peer".

Change (rebased onto v1.16.0)

  • LoadVerify waits until the file lists a trusted peer.
  • Both tests allow 5 s, which is what failed under load.

Test-only; no product code changes. ./tests runs only locally since the nightly workflow was removed, so CI does not exercise this. Locally the two tests passed 5 of 5 runs after the rebase.

🤖 Generated with Claude Code

#500 made TestHandshakeTrustLoadVerify and TestHandshakeTrustPersistence
wait up to 2s for trust.json to exist. The handshake manager writes the
file from a goroutine after the in-memory state changes, and its first
write can still hold only the pending request, so LoadVerify could read a
file with no trusted peer ("trust file should have at least one trusted
peer"). It now waits for a write that lists one, and both tests allow 5s,
which is what failed under load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TeoSlayer
TeoSlayer force-pushed the tests/deflake-trust-file branch from 45d719a to 36eea9e Compare October 7, 2026 12:58
@TeoSlayer
TeoSlayer merged commit 6940d52 into main Oct 7, 2026
14 checks passed
@TeoSlayer
TeoSlayer deleted the tests/deflake-trust-file branch October 7, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant