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:
@@ -98,7 +98,7 @@ public class BroadcastLogSinkTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Does_not_throw_when_detached()
|
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);
|
var sink = new BroadcastLogSink(buffer);
|
||||||
sink.Emit(Evt(LogEventLevel.Error, "no subscriber"));
|
sink.Emit(Evt(LogEventLevel.Error, "no subscriber"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user