From 8daadc8a77ce6379e6ad60ba3a750e90d326b2fb Mon Sep 17 00:00:00 2001 From: dmolinari Date: Sun, 19 Apr 2026 07:40:32 -0300 Subject: [PATCH] =?UTF-8?q?fix(tests):=20timestamp=20determin=C3=ADstico?= =?UTF-8?q?=20en=20QueryAsync=5FLimit=5FEmitsCursor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DATETIME2(3) + cursor roundtrip via O format perdía sub-ms de DateTime.UtcNow causando ~37% flake rate. Timestamp fijo con sub-ms=0 elimina la ambigüedad. Fixes residual flake del issue #29. --- .../Infrastructure/Audit/AuditEventRepositoryTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/SIGCM2.Application.Tests/Infrastructure/Audit/AuditEventRepositoryTests.cs b/tests/SIGCM2.Application.Tests/Infrastructure/Audit/AuditEventRepositoryTests.cs index 4420348..c637aa6 100644 --- a/tests/SIGCM2.Application.Tests/Infrastructure/Audit/AuditEventRepositoryTests.cs +++ b/tests/SIGCM2.Application.Tests/Infrastructure/Audit/AuditEventRepositoryTests.cs @@ -129,7 +129,10 @@ public sealed class AuditEventRepositoryTests : IAsyncLifetime [Fact] public async Task QueryAsync_Limit_EmitsCursor_WhenMoreRowsAvailable() { - var t0 = DateTime.UtcNow.AddMinutes(-10); + // Determinístico: DATETIME2(3) + cursor roundtrip via "O" format puede perder ticks + // sub-ms de `DateTime.UtcNow` (observado ~37% flake rate, cursor vuelve como parentesis + // de la página anterior). Timestamp fijo con sub-ms = 0 elimina la ambigüedad. + var t0 = new DateTime(2026, 4, 19, 12, 0, 0, DateTimeKind.Utc); await Seed(5, t0); var page1 = await _repo.QueryAsync(new AuditEventFilter(null, null, null, null, null, null, Limit: 2));