From 16a28f3e6b4f5f743c8705e1be65b45d837edfdc Mon Sep 17 00:00:00 2001 From: "F." Date: Fri, 10 Apr 2026 09:12:41 +0200 Subject: [PATCH] fix: resolve CI failures from v4 launch - Change test baseTime from Jan 1 to Jun 3 to prevent januaryFirstOffsetSpec from firing unexpectedly (negative WaitGroup) - Handle missing go.sum in tidy-check CI steps (no dependencies) - Increase chain_test timing constants for race-detector stability Co-Authored-By: Claude Opus 4.6 --- .github/workflows/go.yml | 3 ++- .github/workflows/lint.yml | 3 ++- chain_test.go | 10 +++++----- cron_test.go | 7 ++++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a450059..ce890b0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -46,7 +46,8 @@ jobs: - name: Tidy check run: | go mod tidy - git diff --exit-code go.mod go.sum + git diff --exit-code go.mod + test ! -f go.sum || git diff --exit-code go.sum - name: Verify run: go mod verify diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8e54adb..56fed08 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -46,7 +46,8 @@ jobs: - name: Tidy check run: | go mod tidy - git diff --exit-code go.mod go.sum + git diff --exit-code go.mod + test ! -f go.sum || git diff --exit-code go.sum - name: gci run: gci write -s standard -s default -s blank -s dot -s "prefix(${{ steps.settings.outputs.gci_prefix }})" -s localmodule --skip-vendor --skip-generated $(find . -type f -name '*.go' -not -path "./pkg/api/*" -not -path "./vendor/*" -not -path "./.gocache/*" -not -path "./.git/*") - name: gofumpt diff --git a/chain_test.go b/chain_test.go index 9f096f9..1015813 100644 --- a/chain_test.go +++ b/chain_test.go @@ -10,11 +10,11 @@ import ( ) const ( - jobCompletionWait = 2 * time.Millisecond - twoJobCompletionWait = 3 * time.Millisecond - delayedJobDuration = 10 * time.Millisecond - waitForFirstJob = 5 * time.Millisecond - waitForDelayedJobs = 25 * time.Millisecond + jobCompletionWait = 10 * time.Millisecond + twoJobCompletionWait = 20 * time.Millisecond + delayedJobDuration = 50 * time.Millisecond + waitForFirstJob = 25 * time.Millisecond + waitForDelayedJobs = 150 * time.Millisecond rapidFireJobRuns = 11 rapidFireCompletionWait = 200 * time.Millisecond independentJobsWait = 100 * time.Millisecond diff --git a/cron_test.go b/cron_test.go index 0169447..c4b4d7d 100644 --- a/cron_test.go +++ b/cron_test.go @@ -32,8 +32,9 @@ const ( ) // baseTime is a fixed instant used by fake-clock tests. It is midnight UTC on -// a Monday so that day-of-week specs behave predictably. -var baseTime = time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) //nolint:gochecknoglobals // test constant +// a Monday in a neutral month so that January/December-specific specs never +// fire unexpectedly. +var baseTime = time.Date(2024, 6, 3, 0, 0, 0, 0, time.UTC) //nolint:gochecknoglobals // test constant // awaitTimeout is the real-time safety net for tests that advance a fake clock // and then wait for a goroutine to observe the result. @@ -458,7 +459,7 @@ func TestLocalTimezone(t *testing.T) { wg := &sync.WaitGroup{} wg.Add(2) - // baseTime is 2024-01-01 00:00:00 UTC. Seconds 1 and 2 will fire. + // Seconds 1 and 2 relative to baseTime will fire. fc := newFakeClock(baseTime) cron := New(WithParser(testParserWithSeconds()), WithChain(), WithClock(fc), WithLocation(time.UTC))