test: replace Tunn unit tests with integration test suite#210
Open
thomaseizinger wants to merge 1 commit into
Open
test: replace Tunn unit tests with integration test suite#210thomaseizinger wants to merge 1 commit into
thomaseizinger wants to merge 1 commit into
Conversation
Replace the behavioural unit tests in noise/mod.rs and the replay counter test in session.rs with an integration test suite that drives two Tunn instances against each other through the public sans-IO API only. A harness (tests/it/harness.rs) provides a virtual clock, an in-memory network with fault injection and a timestamped packet log, so each test reads as a short scenario. The protocol constants are redefined from the WireGuard whitepaper so the tests assert conformance to the paper rather than to the implementation. The suite covers the handshake (incl. PSK, replay and simultaneous initiation), data transfer, replay protection at the wire level, the cookie/DoS mechanism, all whitepaper timers, and the sans-IO-specific contracts around next_timer_update, jitter and determinism. The crypto test vectors, the Index unit tests and the docker-based device tests are kept as-is. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SsK9EkMSKVDctKeasSW4sS
Member
Author
|
I reviewed these tests. They are all sound and the harness is quite well written. Should enable us to update and merge #94 with confidence. |
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.
The behavioural unit tests in
noise/mod.rsand the replay-counter test insession.rsreached into private state, duplicated handshake plumbing per test and left notable gaps: no coverage for the cookie/DoS mechanism, wire-level replay, rekey/session rotation, tampered or malformed input, or thenext_timer_updatecontract.This replaces them with an integration test suite (
tests/it) that drives twoTunninstances against each other through the public sans-IO API on a virtual clock. A harness provides an in-memory network with fault injection and a timestamped packet log, so each test reads as a short scenario. Protocol constants are redefined from the WireGuard whitepaper and each test cites the section it exercises, so the suite asserts conformance to the paper rather than to the implementation. Sans-IO-specific behaviour (jittered handshake scheduling,next_timer_updateaccuracy, tolerance to coarse polling, seed determinism, the internal packet queue) is covered separately intests/it/sans_io.rs.The suite is deterministic (fixed jitter seeds), runs in ~0.2s and passes under every feature combination with
-Dwarnings. The crypto test vectors, theIndexunit tests and the docker-based device tests are kept as-is.