Skip to content

Migrate remaining tests to testify#354

Merged
folbricht merged 1 commit into
masterfrom
testify-migration
Jun 11, 2026
Merged

Migrate remaining tests to testify#354
folbricht merged 1 commit into
masterfrom
testify-migration

Conversation

@folbricht

Copy link
Copy Markdown
Owner

Converts the 17 test files still using hand-rolled if err != nil { t.Fatal(err) } / t.Errorf checks to testify, simplifying the tests (net -287 lines).

  • require for fatal checks, assert where tests previously used t.Errorf to continue after a failure (loop checks in the escape tests, per-chunk verification in TestChunkStreamIntegrity, table-driven field checks in remotehttp_test.go).
  • The combined three-condition t.Errorf checks in remotehttp_test.go are split into one assertion per field for clearer failure output.
  • Error-type assertions (err.(ChunkMissing) etc.) become require.IsType; the sentinel comparison in failover_test.go becomes require.ErrorIs.
  • Checks inside spawned goroutines (errgroup workers in protocol_test.go, s3_test.go, failover_test.go) keep passing errors back over channels, per the rule that t.Fatal()/require must only run on the test goroutine (Do not call t.Fatal() from non-main goroutines #291).
  • reflect.DeepEqual comparisons become require.Equal/require.IsType, dropping the reflect import in five files; a stale commented-out block in dedupqueue_test.go is removed.
  • Benchmarks keep b.Fatal; store_test.go is a pure helper with no assertions and is unchanged.

go test ./... passes for both the library and CLI packages.

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.
@folbricht folbricht merged commit c7a46a7 into master Jun 11, 2026
3 checks passed
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