Skip to content

fix test flake: use db precision timestamps for test_audit_log_basic#10276

Merged
david-crespo merged 2 commits intomainfrom
db-precision-tests
Apr 16, 2026
Merged

fix test flake: use db precision timestamps for test_audit_log_basic#10276
david-crespo merged 2 commits intomainfrom
db-precision-tests

Conversation

@david-crespo
Copy link
Copy Markdown
Contributor

@david-crespo david-crespo commented Apr 16, 2026

Closes #10274

test_audit_log_basic takes Utc::now() timestamps before and after DB operations and asserts that the timestamp on the audit log entry falls between them. But Utc::now() has nanosecond precision and CockroachDB truncates to microseconds, so if t1 is 19:16:44.154913040 and the audit log entry was written at .154913999, the value read back from the DB would be 19:16:44.154913, which is before t1. Use now_db_precision() so the test timestamps have the same precision as the DB. The comparisons were already t1 <= log_time, so they will work if they're equal.

@david-crespo david-crespo enabled auto-merge (squash) April 16, 2026 03:36
@david-crespo david-crespo merged commit 8676f30 into main Apr 16, 2026
16 checks passed
@david-crespo david-crespo deleted the db-precision-tests branch April 16, 2026 21:44
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.

test failed in CI: db::datastore::audit_log::tests::test_audit_log_basic

2 participants