Migrate remaining tests to testify#354
Merged
Merged
Conversation
Convert the 17 test files still using hand-rolled t.Fatal/t.Errorf checks to testify, using require for fatal assertions and assert where tests previously continued after a failure. Checks running in spawned goroutines keep passing errors back over channels per the t.Fatal() goroutine restriction. Drops the reflect-based comparisons and a stale commented-out block, removing ~290 lines.
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.
Converts the 17 test files still using hand-rolled
if err != nil { t.Fatal(err) }/t.Errorfchecks to testify, simplifying the tests (net -287 lines).requirefor fatal checks,assertwhere tests previously usedt.Errorfto continue after a failure (loop checks in the escape tests, per-chunk verification inTestChunkStreamIntegrity, table-driven field checks inremotehttp_test.go).t.Errorfchecks inremotehttp_test.goare split into one assertion per field for clearer failure output.err.(ChunkMissing)etc.) becomerequire.IsType; the sentinel comparison infailover_test.gobecomesrequire.ErrorIs.protocol_test.go,s3_test.go,failover_test.go) keep passing errors back over channels, per the rule thatt.Fatal()/requiremust only run on the test goroutine (Do not call t.Fatal() from non-main goroutines #291).reflect.DeepEqualcomparisons becomerequire.Equal/require.IsType, dropping thereflectimport in five files; a stale commented-out block indedupqueue_test.gois removed.b.Fatal;store_test.gois a pure helper with no assertions and is unchanged.go test ./...passes for both the library and CLI packages.