Repository navigation
test: run small-package tests in parallel - #1390
Conversation
Signed-off-by: bootjp <contact@bootjp.me>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
TLA+ spec divergence review (auto-triggered)This PR touches files that the TLA+ safety spec has an anchor on (per Anchored files changed in this PR head (56876a6):
What to check, by subsystem:
If the change is correct but requires a spec update, edit @claude review please verify TLA+ spec divergence per the checklist above. @codex review please verify TLA+ spec divergence per the checklist above. |
TLA+ spec divergence review (auto-triggered)This PR touches files that the TLA+ safety spec has an anchor on (per Anchored files changed in this PR head (88a5da5):
What to check, by subsystem:
If the change is correct but requires a spec update, edit @claude review please verify TLA+ spec divergence per the checklist above. @codex review please verify TLA+ spec divergence per the checklist above. |
…dline TestRunLiveBackupStopsRenewalBeforeManifestPublication failed the rest shard with "renew live backup pin: context deadline exceeded". The fake releases the stream only once the renewal RPC is in flight, and at a 300ms TTL that RPC's attempt timeout is 100ms, so streaming plus finalize had to finish within 100ms for stop() to end the renewal. Under -race on a loaded runner it overran and the test took the deadline route instead. A 3000ms TTL leaves 1s. The failure predates the t.Parallel additions: the test was already parallel on main and failed there too. Measured with go test -race -count=10 ./internal/backup: 3 failures before, 0 after. Signed-off-by: bootjp <contact@bootjp.me>
TLA+ spec divergence review (auto-triggered)This PR touches files that the TLA+ safety spec has an anchor on (per Anchored files changed in this PR head (373407f):
What to check, by subsystem:
If the change is correct but requires a spec update, edit @claude review please verify TLA+ spec divergence per the checklist above. @codex review please verify TLA+ spec divergence per the checklist above. |
Summary
Adds
t.Parallel()to 208 top-level tests in./cmd/...,./internal,./internal/backup,./internal/peersession,./internal/raftadmission,./internal/snapshotoffload,./internal/s3keys,./internal/testutil/...,./keyviz,./distribution/autosplit,./store/storetest,./internal/raftengine/raftenginetest,./internal/encryption/encryptiontestthat did not call it (1038 already did). Part of the effort to parallelize the Go test suite; CI-side sharding is in #1387.Candidates were picked with a go/ast scan that skips any test which (directly or through same-package helpers) calls
t.Setenv/os.Setenv/os.Chdir, writes a package-level variable from test code, calls process-global setters (slog.SetDefault,prometheus.MustRegister,signal.Notify,runtime.GOMAXPROCS(n), …), or carries a comment about parallelism.Left serial (27 tests):
flagpackage globals (cmd/elastickv-split8 viaresetFlags,cmd/elastickv-list-routes1).t.Setenv/os.Unsetenv(cmd/raftadmin6,internal/backup2,cmd/elastickv-admin1).os.StdoutthroughcaptureStdout(cmd/raftadmin).testing.AllocsPerRun(internal/peersession).runtime.NumGoroutine(internal/snapshotoffload).cmd/server).internal:TestGRPCForwardTokenOnlyAuthenticatesPeerForward,TestConfigureGRPCTLSValidatesFiles,TestGRPCTLSCommonOptionsVerifyPeer. They callConfigureGRPCForwardToken/ConfigureGRPCTLS, which store into the package-level atomicsgrpcForwardToken/grpcTLS. The scan cannot see that because the write happens through a method call. Each one has a// Not parallel:comment naming the global.cmd/*tests were checked by hand. The parallelized ones callrun(args, …)with their ownflag.FlagSet, or pure helpers. None of them readsflag.CommandLine,os.Args, oros.Stdout.TestProductionImportGuardexecs a subprocess but passes its env throughcmd.Env, not the process environment.Behavior change / risk
Test-only. No production code changes. The risk is a hidden shared-state flake that
-count=3did not catch. Each package's serial tests still finish before its parallel tests resume, so the serial tests that change globals cannot overlap the new parallel ones.Test evidence
go test -race -count=3on all listed packages: ok-race -count=1), before → after (the machine was under heavy load from other test runs, load average about 10–14, so these numbers are noisy):TestSchedulerStaggerDoesNotAccumulateAcrossGroups~9.6s,TestSchedulerBoundsScanGoroutines~8.6s), so the spread is load noise.golangci-lint runon all listed packages: 0 issuesgofmt -l: cleanSelf-review
flagvars,os.Stdout, env,grpcTLS,grpcForwardToken) stay serial. The new parallel tests uset.TempDir(),127.0.0.1:0listeners, and per-test fixtures.encryptiontestnonce IDs come from an atomic counter. Passed-race -count=3.t.Parallel()lines and three comments.