コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        public void UnhealthyOnAtLeastOneChild_UnsetBadChild_IsHealthy(ReportingStrategy reportingStrategy)
        {
            _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
            _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "parent", "child");
            _getHealthResult().IsHealthy.ShouldBe(false);

            _healthStatus.Unset("parent", "child");
            _getHealthResult().IsHealthy.ShouldBe(true);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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");
        }
コード例 #7
0
        public void BadState_Expires(ReportingStrategy reportingStrategy)
        {
            _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
            _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "level1");
            var result = _getHealthResult();

            result.IsHealthy.ShouldBe(false);

            _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1);
            result = _getHealthResult();
            result.IsHealthy.ShouldBe(true);
        }
コード例 #8
0
 public void Default_IsHealthy(ReportingStrategy reportingStrategy)
 {
     _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
     _getHealthResult().IsHealthy.ShouldBe(true);
 }