public void UnhealthyOnAtLeastOneChild__OneChildInBadState_IsUnhealthy() { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, ReportingStrategy.UnhealthyOnAtLeastOneChild); _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "badChild"); _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "goodChild"); _getHealthResult().IsHealthy.ShouldBe(false); }
public void ChildExpiry_PospondsParentExpiry(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "parent", "child1"); // now parent is in one second delay _healthStatus.SetBad("", TimeSpan.FromSeconds(2), "parent", "child2"); // child2 will expire only after two seconds _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1); _getHealthResult().IsHealthy.ShouldBe(false); }
public void ChildState_TurnToGood_IsHealthy(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "child"); _getHealthResult().IsHealthy.ShouldBe(false); _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "child"); _getHealthResult().IsHealthy.ShouldBe(true); }
public void MessageShouldContainChildDetails(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); var childDetails = "child details"; _healthStatus.SetGood(childDetails, TimeSpan.FromSeconds(1), "child1"); var result = _getHealthResult(); result.IsHealthy.ShouldBe(true); result.Message.ShouldContain(childDetails); }
public void ChildMessage_Expires(ReportingStrategy reportingStrategy) { _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy); _healthStatus.SetGood("details", TimeSpan.FromSeconds(1), "level1"); var result = _getHealthResult(); result.Message.ShouldContain("details"); _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1); result = _getHealthResult(); result.Message.ShouldNotContain("details"); }