fix(health-monitoring): resolve HealthMonitoring-013,014,016 — shorter-timeout cadence, options validation, injected TimeProvider; HealthMonitoring-015 left open (cross-module design decision)

This commit is contained in:
Joseph Doherty
2026-05-17 03:18:24 -04:00
parent da8c9f171b
commit eae4077414
8 changed files with 296 additions and 12 deletions

View File

@@ -131,6 +131,24 @@ public class SiteHealthCollectorTests
Assert.InRange(report.ReportTimestamp, before, after);
}
/// <summary>
/// HealthMonitoring-016 regression: <see cref="SiteHealthCollector.CollectReport"/>
/// must stamp <c>ReportTimestamp</c> from an injected <see cref="TimeProvider"/>
/// (consistent with the rest of the module), not directly from
/// <c>DateTimeOffset.UtcNow</c>, so the report timestamp is deterministically
/// testable against a known instant.
/// </summary>
[Fact]
public void CollectReport_StampsTimestamp_FromInjectedTimeProvider()
{
var fixedInstant = new DateTimeOffset(2026, 5, 17, 9, 30, 0, TimeSpan.Zero);
var collector = new SiteHealthCollector(new TestTimeProvider(fixedInstant));
var report = collector.CollectReport("site-1");
Assert.Equal(fixedInstant, report.ReportTimestamp);
}
[Fact]
public void CollectReport_SequenceNumberIsZero_CallerAssignsIt()
{