< Summary

Information
Class: Anichron.API.Infrastructure.ProxyStorageHealthCheck
Assembly: Anichron.API
File(s): /home/runner/work/anichron/anichron/src/Anichron.API/Infrastructure/ProxyStorageHealthCheck.cs
Tag: 228_36821334185
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 23
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.API.Settings;
 2using Microsoft.Extensions.Diagnostics.HealthChecks;
 3using System.IO.Abstractions;
 4
 5namespace Anichron.API.Infrastructure;
 6
 37internal sealed class ProxyStorageHealthCheck(IFileSystem fileSystem) : IHealthCheck
 8{
 9    public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = de
 310    {
 11        try
 312        {
 313            return Task.FromResult(
 314                fileSystem.Directory.Exists(AppDefaults.Storage.ProxyPath)
 315                    ? HealthCheckResult.Healthy("Proxy storage directory found.")
 316                    : HealthCheckResult.Degraded("Proxy storage directory not found."));
 17        }
 118        catch (Exception ex)
 119        {
 120            return Task.FromResult(HealthCheckResult.Unhealthy("Proxy storage check failed.", ex));
 21        }
 322    }
 23}