fix(worker-tests): pin LogRingBuffer clock in Does_not_throw_when_detached

The test built the buffer with the real DateTime.UtcNow clock but emitted
an event with the file's fixed EvtTime timestamp (2026-06-23). As real
time drifted more than the 1h window past that fixed timestamp, the
just-appended record was evicted inside the same Append call, before
Snapshot() ran. BroadcastLogSink.Emit itself buffers unconditionally
regardless of attach state, so this was a test bug, not a sink bug. Pin
the buffer's clock to EvtTime, matching every sibling test's NewSink setup.
This commit is contained in:
mika kuns
2026-07-29 12:10:58 +02:00
parent db447f36da
commit 58f8b11dbb
@@ -98,7 +98,7 @@ public class BroadcastLogSinkTests
[Fact]
public void Does_not_throw_when_detached()
{
var buffer = new LogRingBuffer(TimeSpan.FromHours(1));
var buffer = new LogRingBuffer(TimeSpan.FromHours(1), utcNow: () => EvtTime.UtcDateTime);
var sink = new BroadcastLogSink(buffer);
sink.Emit(Evt(LogEventLevel.Error, "no subscriber"));