Skip to content

feat(testing): ResetState takes testing.TB (#605) - #820

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/605-resetstate-testing-tb
Sep 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/605-resetstate-testing-tb

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

TestServer.ResetState was the last harness entry point still requiring *testing.T.
StartTestServer, StartTestServerWithAccounts and RegisterAccount widened to testing.TB in
#798, so a *testing.B could start a server but not reset it between iterations — and no cast
bridges the gap, since testing.TB has an unexported method.

The change is source-compatible: *testing.T satisfies testing.TB, so all 262 existing call
sites compile unchanged. Everything the body uses (Helper, Fatalf) is on testing.TB already.

BenchmarkS3PutObject_Latency now drives StartTestServer(b) + ResetState(b) over loopback HTTP
instead of a hand-rolled plugin/registry/server behind an httptest recorder. That is the standing
proof the widening is complete — the benchmark does not compile without it — and it is the shape the
issue's downstream consumer benchmarks in: the measured path includes the transport, so a request
costs an HTTP round trip here as it does in production rather than a map lookup. Its numbers are
therefore not comparable with the recorder-based ones it replaces (208µs/op vs 34µs/op locally).

docs/testing-guide.md gets the corrected signature and a short benchmark section noting that
setup belongs before b.ResetTimer() and ResetState outside the measured loop.

Verification

gofmt/go build/go vet/golangci-lint clean; make test and GOTOOLCHAIN=go1.26.6 make test
pass; docs reference, version and authz-reference checks pass; npm --prefix docs run build and the
e2e suite pass. go test -bench . -benchtime 1x ./emulator/ runs all five benchmarks green.

Closes #605

@scttfrdmn scttfrdmn added this to the v0.113.0 milestone Sep 12, 2026
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/testing.go 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 485906a into main Sep 12, 2026
16 of 17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/605-resetstate-testing-tb branch September 12, 2026 06:08
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.

emulator: StartTestServer takes *testing.T, so a benchmark cannot use it

1 participant