From 0f52e13577f874c686fea85e99ac9852164fe484 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:42:33 +0000 Subject: [PATCH 1/2] build(deps): Bump github.com/jonboulle/clockwork from 0.4.0 to 0.5.0 Bumps [github.com/jonboulle/clockwork](https://github.com/jonboulle/clockwork) from 0.4.0 to 0.5.0. - [Release notes](https://github.com/jonboulle/clockwork/releases) - [Commits](https://github.com/jonboulle/clockwork/compare/v0.4.0...v0.5.0) --- updated-dependencies: - dependency-name: github.com/jonboulle/clockwork dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 70115433c..1f0adade5 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/herumi/bls-eth-go-binary v1.36.1 github.com/holiman/uint256 v1.3.2 github.com/ipfs/go-log/v2 v2.5.1 - github.com/jonboulle/clockwork v0.4.0 + github.com/jonboulle/clockwork v0.5.0 github.com/jsternberg/zap-logfmt v1.3.0 github.com/libp2p/go-libp2p v0.37.2 github.com/libp2p/go-msgio v0.3.0 diff --git a/go.sum b/go.sum index 1cb30a516..91a0b6c0e 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,8 @@ github.com/jdx/go-netrc v1.0.0/go.mod h1:Gh9eFQJnoTNIRHXl2j5bJXA1u84hQWJWgGh569z github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jhump/protoreflect/v2 v2.0.0-beta.2 h1:qZU+rEZUOYTz1Bnhi3xbwn+VxdXkLVeEpAeZzVXLY88= github.com/jhump/protoreflect/v2 v2.0.0-beta.2/go.mod h1:4tnOYkB/mq7QTyS3YKtVtNrJv4Psqout8HA1U+hZtgM= -github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= -github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= +github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= +github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= From 7c7509353c41757b9d7177e543ed65be775bca1b Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Tue, 21 Jan 2025 11:57:54 +0200 Subject: [PATCH 2/2] Fix clockwork breaking changes --- app/monitoringapi_internal_test.go | 17 ++++++++++------- core/scheduler/scheduler_test.go | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/monitoringapi_internal_test.go b/app/monitoringapi_internal_test.go index 078183db9..bd4900a0b 100644 --- a/app/monitoringapi_internal_test.go +++ b/app/monitoringapi_internal_test.go @@ -156,16 +156,16 @@ func TestStartChecker(t *testing.T) { } // Advance clock for first tick. - advanceClock(clock, 10*time.Second) + advanceClock(t, ctx, clock, 10*time.Second) // Advance clock for first epoch tick. - advanceClock(clock, 32*12*time.Second) + advanceClock(t, ctx, clock, 32*12*time.Second) waitFor := 1 * time.Second tickInterval := 1 * time.Millisecond if tt.err != nil { require.Eventually(t, func() bool { - advanceClock(clock, 10*time.Second) + advanceClock(t, ctx, clock, 10*time.Second) err = readyErrFunc() if !errors.Is(err, tt.err) { t.Logf("Ignoring unexpected error, got=%v, want=%v", err, tt.err) @@ -176,7 +176,7 @@ func TestStartChecker(t *testing.T) { }, waitFor, tickInterval) } else { require.Eventually(t, func() bool { - advanceClock(clock, 12*time.Second) + advanceClock(t, ctx, clock, 12*time.Second) return readyErrFunc() == nil }, waitFor, tickInterval) } @@ -184,12 +184,15 @@ func TestStartChecker(t *testing.T) { } } -func advanceClock(clock clockwork.FakeClock, duration time.Duration) { +func advanceClock(t *testing.T, ctx context.Context, clock *clockwork.FakeClock, duration time.Duration) { + t.Helper() numTickers := 2 // We wrap the Advance() calls with blockers to make sure that the ticker // can go to sleep and produce ticks without time passing in parallel. - clock.BlockUntil(numTickers) + err := clock.BlockUntilContext(ctx, numTickers) + require.NoError(t, err) clock.Advance(duration) - clock.BlockUntil(numTickers) + err = clock.BlockUntilContext(ctx, numTickers) + require.NoError(t, err) } diff --git a/core/scheduler/scheduler_test.go b/core/scheduler/scheduler_test.go index 262edfaba..a27760852 100644 --- a/core/scheduler/scheduler_test.go +++ b/core/scheduler/scheduler_test.go @@ -517,3 +517,7 @@ func (c *testClock) NewTimer(time.Duration) clockwork.Timer { func (c *testClock) AfterFunc(time.Duration, func()) clockwork.Timer { panic("not supported") } + +func (c *testClock) Until(t time.Time) time.Duration { + panic("not supported") +}