fix(health-monitoring): resolve HealthMonitoring-004,006,010,011,012 — heartbeat-doc accuracy, testable sequence seeding, logged failures, dead-code removal
This commit is contained in:
@@ -110,6 +110,29 @@ public class CentralHealthReportLoopTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HealthMonitoring-006 regression: the central loop's sequence-number seed
|
||||
/// must be derived from the injected <see cref="TimeProvider"/> (Unix-ms),
|
||||
/// not from <c>DateTimeOffset.UtcNow</c> read at field initialization, so the
|
||||
/// seeding strategy is deterministically testable.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void SequenceNumberSeed_UsesInjectedTimeProvider()
|
||||
{
|
||||
var fixedInstant = new DateTimeOffset(2026, 5, 16, 12, 0, 0, TimeSpan.Zero);
|
||||
var timeProvider = new TestTimeProvider(fixedInstant);
|
||||
|
||||
var loop = new CentralHealthReportLoop(
|
||||
new SiteHealthCollector(),
|
||||
new RecordingAggregator(),
|
||||
new FakeClusterNodeProvider { SelfIsPrimary = true },
|
||||
Options.Create(new HealthMonitoringOptions()),
|
||||
NullLogger<CentralHealthReportLoop>.Instance,
|
||||
timeProvider);
|
||||
|
||||
Assert.Equal(fixedInstant.ToUnixTimeMilliseconds(), loop.CurrentSequenceNumber);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SetsActiveNodeFlag_EvenWhenNotPrimary()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user