< Summary

Information
Class: Anichron.API.Infrastructure.ProxyStorageHealthCheck
Assembly: Anichron.API
File(s): /home/runner/work/anichron/anichron/src/Anichron.API/Infrastructure/ProxyStorageHealthCheck.cs
Tag: 19_45211875487
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 22
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
CheckHealthAsync(...)100%22100%

File(s)

/home/runner/work/anichron/anichron/src/Anichron.API/Infrastructure/ProxyStorageHealthCheck.cs

#LineLine coverage
 1using Anichron.Infrastructure.Storage;
 2using Microsoft.Extensions.Diagnostics.HealthChecks;
 3
 4namespace Anichron.API.Infrastructure;
 5
 46internal sealed class ProxyStorageHealthCheck(IProxyStore store) : IHealthCheck
 7{
 8    public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = de
 39    {
 10        try
 311        {
 312            return Task.FromResult(
 313                store.RootExists()
 314                    ? HealthCheckResult.Healthy("Proxy storage directory found.")
 315                    : HealthCheckResult.Degraded("Proxy storage directory not found."));
 16        }
 117        catch (Exception ex)
 118        {
 119            return Task.FromResult(HealthCheckResult.Unhealthy("Proxy storage check failed.", ex));
 20        }
 321    }
 22}