Repository navigation
test(b2): pin writer, reader and progress edges - #257
Open
ffumero2003 wants to merge 4 commits into
Open
ffumero2003 wants to merge 4 commits into
ffumero2003 wants to merge 4 commits into
Conversation
…ter-reader-assertions
This branch has not been deployed
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.
Context
Part of the test-integrity audit (#97). #204 is a checklist of tests that check less than their names say. This PR covers its writer, reader and progress items (slice C4). It was waiting for #236, which changed the same writer and reader code. Sibling PRs: #232, #233, #240, #247, #248 and #249 (all merged).
What each test now proves
TestProgressResumePipeWithoutCallbackTestProgressCloseWaitsForInitialization0/-1after cancelled initialization), not just "some callback happened".TestProgressCancellationHasNoCallbackAfterTerminalTestReaderChunkSizeOneAndDefaults(new)ChunkSize = 1downloads in 1-byte chunks, with literalRangerequestsbytes=0-0,1-1,2-2; the default chunk size applies when unset.TestWriterBufferWriteErrorIsSticky(new)Write, on both the within-chunk and the chunk-crossing paths.TestWriterStatusIncludesAllThreeConcurrentParts(new)Status().Progresshas three entries, all complete at the end.TestWriterDirectWriteUnblocksOnPermanentPartFailure(new)Writedirectly (not throughio.Copy) returns after a permanent part failure instead of blocking.Not covered here:
b2/reader.go:345(Reader.Statusfor the last chunk). The stronger test exposed a production off-by-one: chunk IDs start at 0 butReader.status()iterates from 1, soProgresscomes back[1 0.5 1]instead of[1 1 0.5]. Filed as #256.Coverage removed or narrowed: none. The only replaced assertion ("any callback occurred") became a non-empty check plus an exact check on the last callback.
Also in this branch: the 2-line fix to
b2/core_edges_test.gofrom #252. #247 removed a helper that #249's test still used, so theb2tests don't compile onmainuntil one of these merges. The change is identical in both PRs and merges cleanly.Verification
Each break was applied alone; the named test failed, then passed after revert. Rows marked "exact #204 mutation" are the breaks #204 names.
TestProgressResumePipeWithoutCallbackprogress_review_test.go:110: uploaded content = "", <nil>; want pipe payload, nilTestProgressCloseWaitsForInitializationprogress_review_test.go:183: progress after Close = [{complete:1 total:-1}], want final 0/-1 after cancelled initializationTestProgressCloseWaitsForInitializationprogress_review_test.go:183: progress after Close = [], want final 0/-1 after cancelled initializationTestProgressCancellationHasNoCallbackAfterTerminalprogress_test.go:666: late progress update queued after terminal callbackTestProgressCancellationHasNoCallbackAfterTerminalprogress_test.go:666: late progress update queued after terminal callbackTestReaderChunkSizeOneAndDefaultswriter_reader_edges_test.go:43: chunk size = 10000000, want 1TestReaderChunkSizeOneAndDefaultswriter_reader_edges_test.go:43: chunk size = 10000000, want 1TestReaderChunkSizeOneAndDefaultswriter_reader_edges_test.go:43: chunk size = 0, want 10000000TestWriterBufferWriteErrorIsStickywriter_reader_edges_test.go:98: second Write = 1, <nil>; want 0, original buffer errorTestWriterBufferWriteErrorIsStickywriter_reader_edges_test.go:98: second Write = 1, <nil>; want 0, original buffer errorTestWriterBufferWriteErrorIsStickywriter_reader_edges_test.go:95: first Write = 1, <nil>; want 0, buffer write failedTestWriterBufferWriteErrorIsStickywriter_reader_edges_test.go:98: second Write = 1, <nil>; want 0, original buffer errorTestWriterStatusIncludesAllThreeConcurrentPartswriter_reader_edges_test.go:137: in-flight Progress = [1 1 0], want [1 1 1]TestWriterStatusIncludesAllThreeConcurrentPartswriter_reader_edges_test.go:137: in-flight Progress = [0 0 0], want [1 1 1]TestWriterDirectWriteUnblocksOnPermanentPartFailurewriter_reader_edges_test.go:224: direct Write blocked after permanent part failureTestWriterDirectWriteUnblocksOnPermanentPartFailurewriter_reader_edges_test.go:224: direct Write blocked after permanent part failureWith no B2 credentials set:
go test -race -count=5 -shuffle=on ./b2/...passes, and the added and changed tests pass 30 runs in a row under-race.make ci(tail)Part of #204