Repository navigation
test: keep smart routing reset fixture within one hour - #77
Merged
yetone merged 1 commit intoSep 25, 2026
Merged
Conversation
Owner
|
Thanks — the diagnosis is right: with |
Owner
|
Correction to my aside: the whole gateway test package keeps package-level state (turn counters, rests, subscription runs), so |
Contributor
Author
|
Thanks for confirming and merging! |
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.
Root cause
The Ubuntu test job in #76 failed in
TestSmartRoutingatrouting_test.go:119: it gots#b s#c s#arather thans#c s#b s#ain the "week, then five hours" case (failed job). The test usestime.Now()to create weekly resets for b and c one minute apart. Routing compares their reset times after truncating them to an hour. If the test starts in the final minute of an hour, b and c land in different hour buckets, so b correctly goes before c and the test's expected five-hour tie-breaker does not apply.This fixture predates #76 and is unrelated to its disabled-key change. The provider tests passed in that run.
Fix
Anchor only this routing fixture at 20 minutes into the current hour. Both weekly resets are then in the same hour, so the test consistently checks the five-hour tie-breaker it names. The other timing and rest assertions keep their real-time anchor.
Tests
nowtotime.Now().Truncate(time.Hour).Add(59*time.Minute + 30*time.Second): the exacts#b s#c s#afailure.TZ=UTC go test ./internal/gateway -run '^TestSmartRouting$' -count=1passed;TZ=UTC go test ./internal/gateway ./internal/provider -count=1passed.routingNowto the synthetic 59:30 boundary after the fix reproduces the same failure. Restoring the 20-minute anchor returns the test to green.go test ./...could not compile the GUI in my Linux container: GTK4/WebKitGTK 6 development libraries are absent. The CI workflow installs GTK3/WebKitGTK 4.1 and uses-tags gtk3; the relevant gateway/provider tests above ran locally without GUI dependencies.