Repository navigation
feat(testing): ResetState takes testing.TB (#605) - #820
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
TestServer.ResetStatewas the last harness entry point still requiring*testing.T.StartTestServer,StartTestServerWithAccountsandRegisterAccountwidened totesting.TBin#798, so a
*testing.Bcould start a server but not reset it between iterations — and no castbridges the gap, since
testing.TBhas an unexported method.The change is source-compatible:
*testing.Tsatisfiestesting.TB, so all 262 existing callsites compile unchanged. Everything the body uses (
Helper,Fatalf) is ontesting.TBalready.BenchmarkS3PutObject_Latencynow drivesStartTestServer(b)+ResetState(b)over loopback HTTPinstead of a hand-rolled plugin/registry/server behind an
httptestrecorder. That is the standingproof 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.mdgets the corrected signature and a short benchmark section noting thatsetup belongs before
b.ResetTimer()andResetStateoutside the measured loop.Verification
gofmt/go build/go vet/golangci-lintclean;make testandGOTOOLCHAIN=go1.26.6 make testpass; docs reference, version and authz-reference checks pass;
npm --prefix docs run buildand thee2e suite pass.
go test -bench . -benchtime 1x ./emulator/runs all five benchmarks green.Closes #605