test(registry): reconcile stale WAL torn-tail test with current contract#251
Merged
Conversation
tests/pkg/registry/server held a stale mirror of the rendezvous WAL test suite: TestReplayErrorsOnTruncatedData expected Replay to hard-error on a truncated record. The rendezvous WAL deliberately tolerates a torn tail (a crash between the length-prefix and payload writes) — documented in wal.Replay and covered by rendezvous wal.TestWALReplayTornTail — replaying complete entries and dropping the torn tail. Replace it with TestReplayToleratesTornTail asserting the real contract: a lone torn record replays nothing; a complete entry survives a trailing torn tail. No error in either case.
7e2ed20 to
936a384
Compare
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.
Summary
tests/pkg/registry/server/zz_wal_test.gois an older mirror of therendezvous WAL test suite. Its
TestReplayErrorsOnTruncatedDataassertedthat
Replayhard-errors on a truncated record — but the rendezvous WALdeliberately tolerates a torn tail (a crash between the length-prefix
write and the payload write): it replays the complete entries and drops
the torn tail, returning no error. That behavior is documented in
wal.Replayand covered by rendezvouswal.TestWALReplayTornTail, so thispackage's stale expectation fails against the current dependency.
Fix
Replace it with
TestReplayToleratesTornTail, asserting the real contract:Notes
CI scope (
ci.ymlruns./pkg/... ./cmd/... ./internal/...), so itwasn't gating, but it was a real stale failure.
go test ./tests/pkg/registry/server/now green.