282 references to HealthStatus
Aspire.Components.Common.Tests (3)
ConformanceTests.cs (3)
315HealthStatus expected = CanConnectToServer ? HealthStatus.Healthy : HealthStatus.Unhealthy;
Aspire.Dashboard (13)
Model\ResourceStateViewModel.cs (4)
65else if (resource.HealthStatus is not HealthStatus.Healthy) 113else if (resource is { KnownState: KnownResourceState.Running, HealthStatus: not HealthStatus.Healthy }) 133{ KnownState: KnownResourceState.Running, HealthStatus: not HealthStatus.Healthy } => $"{resource.State.Humanize()} ({(resource.HealthStatus ?? HealthStatus.Unhealthy).Humanize()})",
Model\ResourceViewModel.cs (5)
41public HealthStatus? HealthStatus { get; private set; } 82internal static HealthStatus? ComputeHealthStatus(ImmutableArray<HealthReportViewModel> healthReports, KnownResourceState? state) 91? Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Healthy 95?? Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Unhealthy; 353public sealed record class HealthReportViewModel(string Name, HealthStatus? HealthStatus, string? Description, string? ExceptionText)
ResourceService\Partials.cs (4)
65Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus MapHealthStatus(HealthStatus healthStatus) 69HealthStatus.Healthy => Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Healthy, 70HealthStatus.Degraded => Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Degraded, 71HealthStatus.Unhealthy => Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Unhealthy,
Aspire.Dashboard.Components.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
21HealthStatus? reportHealthStatus = null,
Aspire.Dashboard.Tests (10)
Model\ResourceStateViewModelTests.cs (2)
64HealthStatus? healthStatus = string.IsNullOrEmpty(healthStatusString) ? null : Enum.Parse<HealthStatus>(healthStatusString);
Model\ResourceViewModelTests.cs (7)
10using DiagnosticsHealthStatus = Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus; 24[InlineData(KnownResourceState.Running, DiagnosticsHealthStatus.Healthy, new string[]{})] 25[InlineData(KnownResourceState.Running, DiagnosticsHealthStatus.Healthy, new string?[] {"Healthy"})] 26[InlineData(KnownResourceState.Running, DiagnosticsHealthStatus.Unhealthy, new string?[] {null})] 27[InlineData(KnownResourceState.Running, DiagnosticsHealthStatus.Degraded, new string?[] {"Healthy", "Degraded"})] 28public void Resource_WithHealthReportAndState_ReturnsCorrectHealthStatus(KnownResourceState? state, DiagnosticsHealthStatus? expectedStatus, string?[]? healthStatusStrings) 30var reports = healthStatusStrings?.Select<string?, HealthReportViewModel>((h, i) => new HealthReportViewModel(i.ToString(), h is null ? null : System.Enum.Parse<DiagnosticsHealthStatus>(h), null, null)).ToImmutableArray() ?? [];
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
21HealthStatus? reportHealthStatus = null,
Aspire.Hosting (14)
ApplicationModel\CustomResourceSnapshot.cs (6)
7using HealthStatus = Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus; 70public HealthStatus? HealthStatus { get; private set; } 114internal static HealthStatus? ComputeHealthStatus(ImmutableArray<HealthReportSnapshot> healthReports, string? state) 123? Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Healthy 127?? Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Unhealthy; 231public sealed record HealthReportSnapshot(string Name, HealthStatus? Status, string? Description, string? ExceptionText);
ApplicationModel\ResourceNotificationService.cs (1)
183return WaitForResourceAsync(resourceName, re => re.Snapshot.HealthStatus == HealthStatus.Healthy, cancellationToken: cancellationToken);
Dashboard\proto\Partials.cs (4)
92static HealthStatus MapHealthStatus(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus healthStatus) 96Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Healthy => HealthStatus.Healthy, 97Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Degraded => HealthStatus.Degraded, 98Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Unhealthy => HealthStatus.Unhealthy,
Health\ResourceHealthCheckService.cs (2)
76if (!resourceReadyEventFired && report.Status == HealthStatus.Healthy) 151while (timeProvider.GetUtcNow() < releaseAfter && _latestEvents[lastEvent.Resource.Name] == lastEvent && lastEvent.Snapshot.HealthStatus == HealthStatus.Healthy)
ResourceBuilderExtensions.cs (1)
671/// return <see cref="HealthStatus.Healthy"/>.</para>
Aspire.Hosting.Elasticsearch.Tests (1)
ElasticsearchFunctionalTests.cs (1)
237await rns.WaitForResourceAsync(resource.Resource.Name, (re => re.Snapshot.HealthStatus == Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus.Healthy), cts.Token);
Aspire.Hosting.Qdrant (1)
src\Components\Aspire.Qdrant.Client\QdrantHealthCheck.cs (1)
26: new HealthCheckResult(HealthStatus.Unhealthy);
Aspire.Hosting.Qdrant.Tests (1)
QdrantFunctionalTests.cs (1)
253await rns.WaitForResourceAsync(resource.Resource.Name, (re => re.Snapshot.HealthStatus == HealthStatus.Healthy), cts.Token);
Aspire.Hosting.Tests (8)
Health\HealthStatusTests.cs (6)
20[InlineData(RunningState, HealthStatus.Healthy, new string[]{})] 21[InlineData(RunningState, HealthStatus.Healthy, new string?[] {"Healthy"})] 22[InlineData(RunningState, HealthStatus.Unhealthy, new string?[] {null})] 23[InlineData(RunningState, HealthStatus.Degraded, new string?[] {"Healthy", "Degraded"})] 24public void Resource_WithHealthReportAndState_ReturnsCorrectHealthStatus(string? state, HealthStatus? expectedStatus, string?[]? healthStatusStrings) 26var reports = healthStatusStrings?.Select<string?, HealthReportSnapshot>((h, i) => new HealthReportSnapshot(i.ToString(), h is null ? null : Enum.Parse<HealthStatus>(h), null, null)).ToImmutableArray() ?? [];
Health\ResourceHealthCheckServiceTests.cs (2)
43Assert.Equal(HealthStatus.Healthy, healthyEvent.Snapshot.HealthStatus); 78Assert.Equal(HealthStatus.Unhealthy, runningEvent.Snapshot.HealthStatus);
Aspire.Milvus.Client (1)
MilvusHealthCheck.cs (1)
28: new HealthCheckResult(HealthStatus.Unhealthy, description: milvusHealthState.ToString());
Aspire.Qdrant.Client (1)
QdrantHealthCheck.cs (1)
26: new HealthCheckResult(HealthStatus.Unhealthy);
HealthChecksSample (4)
GCInfoHealthCheck.cs (4)
20HealthStatus? failureStatus = null, 25builder.AddCheck<GCInfoHealthCheck>(name, failureStatus ?? HealthStatus.Degraded, tags); 70var result = allocated >= options.Threshold ? context.Registration.FailureStatus : HealthStatus.Healthy;
HealthChecksSandbox.AppHost (6)
Program.cs (6)
12AddTestResource("healthy", HealthStatus.Healthy, "I'm fine, thanks for asking."); 13AddTestResource("unhealthy", HealthStatus.Unhealthy, "I can't do that, Dave.", exceptionMessage: "Feeling unhealthy."); 14AddTestResource("degraded", HealthStatus.Degraded, "Had better days.", exceptionMessage: "Feeling degraded."); 28void AddTestResource(string name, HealthStatus status, string? description = null, string? exceptionMessage = null) 41return new HealthCheckResult(HealthStatus.Unhealthy, "Initial failure state."); 44return new HealthCheckResult(HealthStatus.Healthy, "Healthy beginning second health check run.");
Microsoft.AspNetCore.Diagnostics.HealthChecks (26)
HealthCheckMiddleware.cs (1)
52$"No status code mapping found for {nameof(HealthStatus)} value: {result.Status}." +
HealthCheckOptions.cs (19)
25private IDictionary<HealthStatus, int> _resultStatusCodes = new Dictionary<HealthStatus, int>(DefaultStatusCodesMapping); 27private static readonly IReadOnlyDictionary<HealthStatus, int> DefaultStatusCodesMapping = new Dictionary<HealthStatus, int> 29{HealthStatus.Healthy, StatusCodes.Status200OK}, 30{HealthStatus.Degraded, StatusCodes.Status200OK}, 31{HealthStatus.Unhealthy, StatusCodes.Status503ServiceUnavailable}, 35/// Gets or sets a dictionary mapping the <see cref="HealthStatus"/> to an HTTP status code applied 40/// <see cref="HealthStatus.Healthy"/> to 200 (OK), <see cref="HealthStatus.Degraded"/> to 200 (OK) and 41/// <see cref="HealthStatus.Unhealthy"/> to 503 (Service Unavailable). 43/// <exception cref="InvalidOperationException">Thrown if at least one <see cref="HealthStatus"/> is missing when setting this property.</exception> 44public IDictionary<HealthStatus, int> ResultStatusCodes 47set => _resultStatusCodes = value != null ? ValidateStatusCodesMapping(value) : new Dictionary<HealthStatus, int>(DefaultStatusCodesMapping); 50private static IDictionary<HealthStatus, int> ValidateStatusCodesMapping(IDictionary<HealthStatus, int> mapping) 52var missingHealthStatus = Enum.GetValues<HealthStatus>().Except(mapping.Keys).ToList(); 55var missing = string.Join(", ", missingHealthStatus.Select(status => $"{nameof(HealthStatus)}.{status}")); 58$"{nameof(HealthStatus)} values. Missing: {missing}";
HealthCheckResponseWriters.cs (6)
12private static readonly byte[] DegradedBytes = Encoding.UTF8.GetBytes(HealthStatus.Degraded.ToString()); 13private static readonly byte[] HealthyBytes = Encoding.UTF8.GetBytes(HealthStatus.Healthy.ToString()); 14private static readonly byte[] UnhealthyBytes = Encoding.UTF8.GetBytes(HealthStatus.Unhealthy.ToString()); 21HealthStatus.Degraded => httpContext.Response.Body.WriteAsync(DegradedBytes.AsMemory()).AsTask(), 22HealthStatus.Healthy => httpContext.Response.Body.WriteAsync(HealthyBytes.AsMemory()).AsTask(), 23HealthStatus.Unhealthy => httpContext.Response.Body.WriteAsync(UnhealthyBytes.AsMemory()).AsTask(),
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (26)
HealthCheckMiddlewareTests.cs (26)
384[HealthStatus.Healthy] = 201, 904Assert.Equal(StatusCodes.Status200OK, options.ResultStatusCodes[HealthStatus.Healthy]); 905Assert.Equal(StatusCodes.Status200OK, options.ResultStatusCodes[HealthStatus.Degraded]); 906Assert.Equal(StatusCodes.Status503ServiceUnavailable, options.ResultStatusCodes[HealthStatus.Unhealthy]); 914Assert.Equal(StatusCodes.Status200OK, options.ResultStatusCodes[HealthStatus.Healthy]); 915Assert.Equal(StatusCodes.Status200OK, options.ResultStatusCodes[HealthStatus.Degraded]); 916Assert.Equal(StatusCodes.Status503ServiceUnavailable, options.ResultStatusCodes[HealthStatus.Unhealthy]); 924ResultStatusCodes = new Dictionary<HealthStatus, int> 926[HealthStatus.Healthy] = 200, 927[HealthStatus.Degraded] = 200, 928[HealthStatus.Unhealthy] = 503 937new HealthCheckOptions { ResultStatusCodes = new Dictionary<HealthStatus, int>() } 939Assert.Contains($"{nameof(HealthStatus)}.{nameof(HealthStatus.Healthy)}", exception.Message); 940Assert.Contains($"{nameof(HealthStatus)}.{nameof(HealthStatus.Degraded)}", exception.Message); 941Assert.Contains($"{nameof(HealthStatus)}.{nameof(HealthStatus.Unhealthy)}", exception.Message); 950ResultStatusCodes = new Dictionary<HealthStatus, int> 952[HealthStatus.Healthy] = 200 956Assert.DoesNotContain($"{nameof(HealthStatus)}.{nameof(HealthStatus.Healthy)}", exception.Message); 957Assert.Contains($"{nameof(HealthStatus)}.{nameof(HealthStatus.Degraded)}", exception.Message); 958Assert.Contains($"{nameof(HealthStatus)}.{nameof(HealthStatus.Unhealthy)}", exception.Message);
Microsoft.Extensions.Diagnostics.HealthChecks (29)
DefaultHealthCheckService.cs (8)
208public static void HealthCheckProcessingEnd(ILogger logger, HealthStatus status, TimeSpan duration) => 212private static partial void HealthCheckProcessingEnd(ILogger logger, HealthStatus HealthStatus, double ElapsedMilliseconds); 223private static partial void HealthCheckEndHealthy(ILogger logger, string HealthCheckName, HealthStatus HealthStatus, double ElapsedMilliseconds, string? HealthCheckDescription); 226private static partial void HealthCheckEndDegraded(ILogger logger, string HealthCheckName, HealthStatus HealthStatus, double ElapsedMilliseconds, string? HealthCheckDescription, Exception? exception); 229private static partial void HealthCheckEndUnhealthy(ILogger logger, string HealthCheckName, HealthStatus HealthStatus, double ElapsedMilliseconds, string? HealthCheckDescription, Exception? exception); 237case HealthStatus.Healthy: 241case HealthStatus.Degraded: 245case HealthStatus.Unhealthy:
DependencyInjection\HealthChecksBuilderAddCheckExtensions.cs (21)
24/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 25/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 34HealthStatus? failureStatus, 47/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 48/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 58HealthStatus? failureStatus = null, 76/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 77/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 91HealthStatus? failureStatus, 104/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 105/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 119HealthStatus? failureStatus = null, 166/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 167/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 179HealthStatus? failureStatus, 195/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 196/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 209HealthStatus? failureStatus, 231/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 232/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 246HealthStatus? failureStatus,
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (34)
HealthCheckRegistration.cs (14)
40public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable<string>? tags) 51/// The <see cref="HealthStatus"/> that should be reported upon failure of the health check. If the provided value 52/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 56public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable<string>? tags, TimeSpan? timeout) 67FailureStatus = failureStatus ?? HealthStatus.Unhealthy; 79/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 80/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 86HealthStatus? failureStatus, 98/// The <see cref="HealthStatus"/> that should be reported when the health check reports a failure. If the provided value 99/// is <c>null</c>, then <see cref="HealthStatus.Unhealthy"/> will be reported. 106HealthStatus? failureStatus, 119FailureStatus = failureStatus ?? HealthStatus.Unhealthy; 140/// Gets or sets the <see cref="HealthStatus"/> that should be reported upon failure of the health check. 142public HealthStatus FailureStatus { get; set; }
HealthCheckResult.cs (5)
24public HealthCheckResult(HealthStatus status, string? description = null, Exception? exception = null, IReadOnlyDictionary<string, object>? data = null) 50public HealthStatus Status { get; } 60return new HealthCheckResult(status: HealthStatus.Healthy, description, exception: null, data); 72return new HealthCheckResult(status: HealthStatus.Degraded, description, exception: exception, data); 84return new HealthCheckResult(status: HealthStatus.Unhealthy, description, exception, data);
HealthReport.cs (9)
31/// <param name="status">A <see cref="HealthStatus"/> representing the aggregate status of all the health checks.</param> 33public HealthReport(IReadOnlyDictionary<string, HealthReportEntry> entries, HealthStatus status, TimeSpan totalDuration) 50/// Gets a <see cref="HealthStatus"/> representing the aggregate status of all the health checks. The value of <see cref="Status"/> 51/// will be the most severe status reported by a health check. If no checks were executed, the value is always <see cref="HealthStatus.Healthy"/>. 53public HealthStatus Status { get; } 60private static HealthStatus CalculateAggregateStatus(IEnumerable<HealthReportEntry> entries) 63var currentValue = HealthStatus.Healthy; 70if (currentValue == HealthStatus.Unhealthy)
HealthReportEntry.cs (3)
26public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data) 41public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data, IEnumerable<string>? tags = null) 74public HealthStatus Status { get; }
HealthStatus.cs (3)
15/// The values of this enum or ordered from least healthy to most healthy. So <see cref="HealthStatus.Degraded"/> is 16/// greater than <see cref="HealthStatus.Unhealthy"/> but less than <see cref="HealthStatus.Healthy"/>.
Microsoft.Extensions.Diagnostics.HealthChecks.Common (9)
Log.cs (2)
14HealthStatus status, 20HealthStatus status);
ManualHealthCheckTracker.cs (3)
34var worstStatus = HealthStatus.Healthy; 38if (check.Status != HealthStatus.Healthy)
Metric.cs (2)
17public static void RecordMetric(this HealthCheckReportCounter counterMetric, HealthStatus status) 20public static void RecordMetric(this UnhealthyHealthCheckCounter counterMetric, string name, HealthStatus status)
TelemetryHealthCheckPublisher.cs (2)
46if (report.Status == HealthStatus.Healthy) 61if (entry.Value.Status != HealthStatus.Healthy)
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (44)
ApplicationLifecycleHealthCheckTests.cs (4)
19Assert.Equal(HealthStatus.Unhealthy, (await healthCheck.CheckHealthAsync(context, CancellationToken.None)).Status); 22Assert.Equal(HealthStatus.Healthy, (await healthCheck.CheckHealthAsync(context, CancellationToken.None)).Status); 25Assert.Equal(HealthStatus.Unhealthy, (await healthCheck.CheckHealthAsync(context, CancellationToken.None)).Status); 28Assert.Equal(HealthStatus.Unhealthy, (await healthCheck.CheckHealthAsync(context, CancellationToken.None)).Status);
ManualHealthCheckTests.cs (12)
21Assert.Equal(HealthStatus.Healthy, healthCheckResult.Status); 25Assert.Equal(HealthStatus.Unhealthy, manualHealthCheck.Result.Status); 38Assert.Equal(HealthStatus.Unhealthy, (await manualHealthCheckService.CheckHealthAsync(context, CancellationToken.None)).Status); 43Assert.Equal(HealthStatus.Unhealthy, healthCheckResultUnhealthy.Status); 48Assert.Equal(HealthStatus.Healthy, healthCheckResultHealthy.Status); 62Assert.Equal(HealthStatus.Unhealthy, (await manualHealthCheckService.CheckHealthAsync(context, CancellationToken.None)).Status); 68Assert.Equal(HealthStatus.Unhealthy, healthCheckResultUnhealthy.Status); 74Assert.Equal(HealthStatus.Healthy, healthCheckResultHealthy.Status); 89Assert.Equal(HealthStatus.Unhealthy, (await manualHealthCheckService.CheckHealthAsync(context, CancellationToken.None)).Status); 97Assert.Equal(HealthStatus.Unhealthy, healthCheckResult2Unhealthy.Status); 104Assert.Equal(HealthStatus.Unhealthy, healthCheckResult1Unhealthy.Status); 111Assert.Equal(HealthStatus.Healthy, healthCheckResultHealthy.Status);
TelemetryHealthChecksPublisherTests.cs (28)
23public static TheoryData<List<HealthStatus>, bool, int, string, LogLevel, string> PublishAsyncArgs => new() 26new List<HealthStatus> { HealthStatus.Healthy }, 31HealthStatus.Healthy.ToString() 34new List<HealthStatus> { HealthStatus.Degraded }, 39HealthStatus.Degraded.ToString() 42new List<HealthStatus> { HealthStatus.Unhealthy }, 47HealthStatus.Unhealthy.ToString() 50new List<HealthStatus> { HealthStatus.Healthy, HealthStatus.Healthy }, 55HealthStatus.Healthy.ToString() 58new List<HealthStatus> { HealthStatus.Healthy, HealthStatus.Unhealthy }, 63HealthStatus.Unhealthy.ToString() 66new List<HealthStatus> { HealthStatus.Healthy, HealthStatus.Degraded, HealthStatus.Unhealthy }, 72HealthStatus.Unhealthy.ToString() 79IList<HealthStatus> healthStatuses, 120var healthStatus = healthStatuses[i]; 121if (healthStatus != HealthStatus.Healthy) 152private static HealthReport CreateHealthReport(IEnumerable<HealthStatus> healthStatuses) 157foreach (var status in healthStatuses)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (46)
DefaultHealthCheckServiceTest.cs (24)
89Assert.Equal(HealthStatus.Degraded, actual.Value.Status); 98Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 111Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 143Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 152Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 191Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 297Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 304Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 311Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 353Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 377Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 401Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 427Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 432Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 481Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 524Assert.Equal(HealthStatus.Healthy, entry.Value.Status); 529Assert.Equal(HealthStatus.Healthy, entry.Value.Status); 555Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status); 598b.AddCheck<FailCapturingCheck>("degraded", HealthStatus.Degraded); 599b.AddCheck<FailCapturingCheck>("healthy", HealthStatus.Healthy); 600b.AddCheck<FailCapturingCheck>("unhealthy", HealthStatus.Unhealthy); 612Assert.Equal(HealthStatus.Degraded, actual.Value.Status); 617Assert.Equal(HealthStatus.Healthy, actual.Value.Status); 622Assert.Equal(HealthStatus.Unhealthy, actual.Value.Status);
DependencyInjection\HealthChecksBuilderTest.cs (12)
27services.AddHealthChecks().AddCheck("test", failureStatus: HealthStatus.Degraded, tags: new[] { "tag", }, instance: instance); 37Assert.Equal(HealthStatus.Degraded, registration.FailureStatus); 47services.AddHealthChecks().AddCheck<TestHealthCheck>("test", failureStatus: HealthStatus.Degraded, tags: new[] { "tag", }); 57Assert.Equal(HealthStatus.Degraded, registration.FailureStatus); 70services.AddHealthChecks().AddCheck<TestHealthCheck>("test", failureStatus: HealthStatus.Degraded, tags: new[] { "tag", }); 80Assert.Equal(HealthStatus.Degraded, registration.FailureStatus); 92.AddTypeActivatedCheck<TestHealthCheckWithArgs>("test", failureStatus: HealthStatus.Degraded, tags: new[] { "tag", }, args: new object[] { 5, "hi", }); 102Assert.Equal(HealthStatus.Degraded, registration.FailureStatus); 128Assert.Equal(HealthStatus.Unhealthy, registration.FailureStatus); 151Assert.Equal(HealthStatus.Unhealthy, registration.FailureStatus); 174Assert.Equal(HealthStatus.Unhealthy, registration.FailureStatus); 197Assert.Equal(HealthStatus.Unhealthy, registration.FailureStatus);
HealthReportTest.cs (10)
15[InlineData(HealthStatus.Healthy)] 16[InlineData(HealthStatus.Degraded)] 17[InlineData(HealthStatus.Unhealthy)] 18public void Status_MatchesWorstStatusInResults(HealthStatus status) 22{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) }, 23{"Bar", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue,null, null) }, 25{"Quick", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) }, 26{"Quack", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) }, 27{"Quock", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) }, 41{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) }
Microsoft.Extensions.Diagnostics.Probes (1)
TcpEndpointProbesService.cs (1)
44if (report.Status == HealthStatus.Healthy)
Microsoft.Extensions.Diagnostics.Probes.Tests (3)
MockHealthCheckService.cs (3)
14private readonly Task<HealthReport> _healthyReport = CreateHealthReport(HealthStatus.Healthy); 15private readonly Task<HealthReport> _unhealthyReport = CreateHealthReport(HealthStatus.Unhealthy); 23private static Task<HealthReport> CreateHealthReport(HealthStatus healthStatus)