fix(tests): generate log records with utc timestamps#237
Conversation
yordis
commented
May 8, 2026
- Keep test-generated log records stable across local timezone boundaries.
- Reduce timestamp-kind drift in storage and projection fixtures that behave like event data.
PR SummaryLow Risk Overview Also includes a small import reordering in Reviewed by Cursor Bugbot for commit 9871438. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughThis PR standardizes test timestamps across seven test files by replacing ChangesTest Timestamp Standardization to UTC
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/EventStore.Core.XUnit.Tests/TransactionLog/LogRecords/PrepareLogRecordViewTests.cs`:
- Line 20: The test fails because _timestamp is set to DateTime.UtcNow
(Kind=Utc) while PrepareLogRecord stores only ticks and PrepareLogRecordView
recreates the DateTime via new DateTime(ticks) (Kind=Unspecified), so Equals
fails; fix by making the test use an Unspecified-kind DateTime that matches the
deserializer (change the _timestamp in PrepareLogRecordViewTests to construct
the expected value with the same ticks/kind produced by
PrepareLogRecord/PrepareLogRecordView—e.g., use new
DateTime(DateTime.UtcNow.Ticks) or explicitly new DateTime(ticks) so
Kind=Unspecified), or alternatively implement round-trip Kind preservation in
PrepareLogRecord.Serialize/PrepareLogRecordView.Deserialize by storing/restoring
DateTime.Kind alongside the 8 tick bytes; update either _timestamp in the test
or the serialize/deserialize in PrepareLogRecord/PrepareLogRecordView
accordingly so ticks and Kind match.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e7f7d1b8-5a78-4517-8023-88c34cff699d
📒 Files selected for processing (7)
src/EventStore.Core.Tests/Services/Storage/WriteEventsToIndexScenario.cssrc/EventStore.Core.XUnit.Tests/Authorization/StreamBasedAuthPolicyRegistryTests.cssrc/EventStore.Core.XUnit.Tests/Index/IndexTrackerTests.cssrc/EventStore.Core.XUnit.Tests/TransactionLog/Chunks/TFChunkTrackerTests.cssrc/EventStore.Core.XUnit.Tests/TransactionLog/LogRecords/PrepareLogRecordViewTests.cssrc/EventStore.Core.XUnit.Tests/TransactionLog/LogRecords/SizeOnDiskTests.cssrc/EventStore.Projections.Core.Javascript.Tests/Integration/SubsystemScenario.cs
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
68f55cf to
9871438
Compare