test: make single sequencer timestamp assertions timezone-agnostic#3367
test: make single sequencer timestamp assertions timezone-agnostic#3367blackflytech wants to merge 1 commit into
Conversation
Signed-off-by: blackflytech <blackflytech@outlook.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTwo unit tests in the single sequencer test file have their timestamp assertions changed from coarse day-of-month comparisons ( ChangesSequencer Timestamp Assertion Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3367 +/- ##
==========================================
+ Coverage 60.63% 60.64% +0.01%
==========================================
Files 129 129
Lines 14205 14205
==========================================
+ Hits 8613 8615 +2
+ Misses 4637 4635 -2
Partials 955 955
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Overview
This updates the single sequencer timestamp assertions to avoid depending on the local timezone.
GetNextBatchreturns timestamps usingtime.Now().UTC(), but the tests compared onlyTimestamp.Day()againsttime.Now().Day(). In non-UTC timezones, this can fail around day boundaries even when the returned timestamp is correct.The tests now use
require.WithinDurationagainsttime.Now().UTC(), which checks the intended behavior directly and avoids local timezone drift.Testing
go test ./pkg/sequencers/single -run 'TestSequencer_GetNextBatch_(NoLastBatch|Success)' -count=1TZ=UTC go test ./pkg/sequencers/single -run 'TestSequencer_GetNextBatch_(NoLastBatch|Success)' -count=1go test ./...git diff --checkSummary by CodeRabbit