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:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user