Fix more intermittent tests in Test_Client_JobCompletion#866
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a series of tests in
Test_Client_JobCompletionthat 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.
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