Replace context.Background with testing.TB.Context where possible (#15416)

* Replace context.Background with testing.TB.Context where possible

* Fix failing tests
This commit is contained in:
Preston Van Loon
2025-06-16 17:09:18 -05:00
committed by GitHub
parent 6a13ba9125
commit 62fec4d1f3
409 changed files with 3175 additions and 3456 deletions

View File

@@ -27,7 +27,7 @@ func TestCountdownToGenesis(t *testing.T) {
firstStringResult := "1s until chain genesis"
genesisReached := "Chain genesis time reached"
CountdownToGenesis(
context.Background(),
t.Context(),
prysmTime.Now().Add(2*time.Second),
params.BeaconConfig().MinGenesisActiveValidatorCount,
[32]byte{},
@@ -38,7 +38,7 @@ func TestCountdownToGenesis(t *testing.T) {
t.Run("close context", func(t *testing.T) {
defer hook.Reset()
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(t.Context())
go func() {
time.AfterFunc(1500*time.Millisecond, func() {
cancel()