Skip to content

Commit df4db9e

Browse files
committed
Note global-state mutation in three new internal-package test files
The summarizer- and validators-side internal tests added on this branch swap the package-level log variable (and, for the summarizer handler test, the summarizerLagEpochs gauge) and restore the originals on teardown. Add a top-of-file note in each file warning future contributors not to add t.Parallel() to any test here, since the global mutation would race across goroutines. No behavioural change.
1 parent 723b098 commit df4db9e

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

services/summarizer/standard/handler_internal_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ import (
2727
"github.com/wealdtech/chaind/services/chaindb"
2828
)
2929

30+
// Tests in this file mutate package-level state — the unexported `log` variable
31+
// and the `summarizerLagEpochs` gauge — and restore the originals on teardown.
32+
// Do NOT add t.Parallel() to any test here; the global mutation would race
33+
// across goroutines.
34+
3035
// stubValidatorsProvider drives summarizeEpoch into the silent-skip and
3136
// zero-balance branches.
3237
type stubValidatorsProvider struct {

services/summarizer/standard/validatorday_internal_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ import (
2727
mockchaintime "github.com/wealdtech/chaind/services/chaintime/mock"
2828
)
2929

30+
// Tests in this file mutate the package-level `log` variable and restore it on
31+
// teardown. Do NOT add t.Parallel() to any test here — the global mutation
32+
// would race across goroutines.
33+
3034
// stubBalanceChainDB pops balance responses from a queue so one fixture can
3135
// drive both the start-balances and end-balances guard paths. daySummariesSet
3236
// records writes so tests can assert the guard short-circuits.

services/validators/standard/handler_internal_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import (
2929
"github.com/wealdtech/chaind/services/chaindb"
3030
)
3131

32+
// Tests in this file mutate the package-level `log` variable via captureWarnLog
33+
// and restore it on teardown. Do NOT add t.Parallel() to any test here — the
34+
// global mutation would race across goroutines.
35+
3236
// captureWarnLog redirects the package logger to a byte buffer at WarnLevel
3337
// and returns the buffer plus a restore func.
3438
func captureWarnLog(t *testing.T) (*bytes.Buffer, func()) {

0 commit comments

Comments
 (0)