Skip to content

Fix more intermittent tests in Test_Client_JobCompletion#866

Merged
brandur merged 1 commit into
masterfrom
brandur-fix-completion-intermittency
Apr 28, 2025
Merged

Fix more intermittent tests in Test_Client_JobCompletion#866
brandur merged 1 commit into
masterfrom
brandur-fix-completion-intermittency

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented Apr 26, 2025

Fix a series of tests in Test_Client_JobCompletion that may fail [1]
intermittently due to their use of a real world clock that may be off as
test goroutines are paused in GitHub Actions for more extended periods
of time.

--- FAIL: Test_Client_JobCompletion (0.00s)
    --- FAIL: Test_Client_JobCompletion/JobThatReturnsJobCancelErrorIsImmediatelyCancelled (4.81s)
        client_test.go:5586: Generated schema "river_2025_04_26t20_41_17_schema_18" with migrations [1 2 3 4 5 6] on line "main" in 2.546342002s [18 generated] [14 reused]
        logger.go:256: time=2025-04-26T20:41:23.623Z level=INFO msg="River client started" client_id=fv-az1370-305_2025_04_26T20_41_23_606599
        client_test.go:5600:
                Error Trace:	/home/runner/work/river/river/client_test.go:5600
                Error:      	Max difference between 2025-04-26 20:41:25.839484186 +0000 UTC m=+8.375195240 and 2025-04-26 20:41:23.819235 +0000 UTC allowed is 2s, but difference was 2.020249186s
                Test:       	Test_Client_JobCompletion/JobThatReturnsJobCancelErrorIsImmediatelyCancelled
        logger.go:256: time=2025-04-26T20:41:25.862Z level=INFO msg="River client stopped" client_id=fv-az1370-305_2025_04_26T20_41_23_606599
        riverdbtest.go:277: Checked in schema "river_2025_04_26t20_41_17_schema_18"; 1 idle schema(s) [18 generated] [15 reused]
FAIL
FAIL	github.com/riverqueue/river	32.869s

Fix these by injecting a test clock and asserting time based on that
instead of the real wall clock.

[1] https://github.com/riverqueue/river/actions/runs/14684878766/job/41212306331

Fix a series of tests in `Test_Client_JobCompletion` that may fail [1]
intermittently due to their use of a real world clock that may be off as
test goroutines are paused in GitHub Actions for more extended periods
of time.

    --- FAIL: Test_Client_JobCompletion (0.00s)
        --- FAIL: Test_Client_JobCompletion/JobThatReturnsJobCancelErrorIsImmediatelyCancelled (4.81s)
            client_test.go:5586: Generated schema "river_2025_04_26t20_41_17_schema_18" with migrations [1 2 3 4 5 6] on line "main" in 2.546342002s [18 generated] [14 reused]
            logger.go:256: time=2025-04-26T20:41:23.623Z level=INFO msg="River client started" client_id=fv-az1370-305_2025_04_26T20_41_23_606599
            client_test.go:5600:
                    Error Trace:	/home/runner/work/river/river/client_test.go:5600
                    Error:      	Max difference between 2025-04-26 20:41:25.839484186 +0000 UTC m=+8.375195240 and 2025-04-26 20:41:23.819235 +0000 UTC allowed is 2s, but difference was 2.020249186s
                    Test:       	Test_Client_JobCompletion/JobThatReturnsJobCancelErrorIsImmediatelyCancelled
            logger.go:256: time=2025-04-26T20:41:25.862Z level=INFO msg="River client stopped" client_id=fv-az1370-305_2025_04_26T20_41_23_606599
            riverdbtest.go:277: Checked in schema "river_2025_04_26t20_41_17_schema_18"; 1 idle schema(s) [18 generated] [15 reused]
    FAIL
    FAIL	github.com/riverqueue/river	32.869s

Fix these by injecting a test clock and asserting time based on that
instead of the real wall clock.

[1] https://github.com/riverqueue/river/actions/runs/14684878766/job/41212306331
@brandur brandur requested a review from bgentry April 26, 2025 21:17
Copy link
Copy Markdown
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤘 thanks

@brandur brandur merged commit d908666 into master Apr 28, 2025
10 checks passed
@brandur brandur deleted the brandur-fix-completion-intermittency branch April 28, 2025 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants