Beispiel #1
0
        public bool IsHealthEventReportingEnabled(string appName, System.Fabric.Health.HealthState aggregatedHealthState)
        {
            var healthEventsFilter = this.Filters.HealthEventsFilter;

            return(healthEventsFilter.IsEntityEnabled(appName) &&
                   healthEventsFilter.IsEntityEnabled(aggregatedHealthState));
        }
Beispiel #2
0
 internal EntityHealth(
     System.Fabric.Health.HealthState aggregatedHealthState,
     IEnumerable <EntityHealthEvent> healthEvents,
     IList <System.Fabric.Health.HealthEvaluation> unhealthyEvaluations)
 {
     this.AggregatedHealthState = aggregatedHealthState;
     this.HealthEvents          = healthEvents;
     this.UnhealthyEvaluations  = unhealthyEvaluations;
 }
Beispiel #3
0
        public async Task PublishAsync_ForReportWithValidHealthStatus_ReportsCorrectSfHealthState(string healthCheckName, HealthStatus healthCheckStatus, SfHealthState expectedSfHealthState)
        {
            // Arrange.
            PublisherTestContext testContext = new PublisherTestContext();

            testContext.ConfigureStatefulServicePartition();

            // Currently report status is calculated as the worst of all healthchecks. In .NET 5 it will be possible to set it independently.
            HealthReport report = new HealthReportBuilder()
                                  .AddEntry(healthCheckName, healthCheckStatus)
                                  .ToHealthReport();

            // Act.
            await testContext.Publisher.PublishAsync(report, cancellationToken : default);

            // Assert.
            Assert.AreEqual(expectedSfHealthState, testContext.ReportedSfHealthInformation(ServiceFabricHealthCheckPublisher.HealthReportSummaryProperty)?.HealthState);
        }
Beispiel #4
0
 internal EntityHealth(System.Fabric.Health.HealthState aggregatedHealthState)
 {
     this.AggregatedHealthState = aggregatedHealthState;
 }
Beispiel #5
0
        public async Task PublishAsync_ForHealthCheckWithValidHealthStatus_ReportsCorrectSfHealthState(string healthCheckName, HealthStatus healthCheckStatus, SfHealthState expectedSfHealthState)
        {
            // Arrange.
            PublisherTestContext testContext = new PublisherTestContext();

            testContext.ConfigureStatelessServicePartition();

            HealthReport report = new HealthReportBuilder()
                                  .AddEntry(healthCheckName, healthCheckStatus)
                                  .ToHealthReport();

            // Act.
            await testContext.Publisher.PublishAsync(report, cancellationToken : default);

            // Assert.
            Assert.AreEqual(expectedSfHealthState, testContext.ReportedSfHealthInformation(healthCheckName)?.HealthState);
        }