< Summary

Information
Class: Elsa.Extensions.ValidateGracefulShutdownOptions
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/OptionConfigurators/ValidateGracefulShutdownOptions.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 32
Line coverage: 100%
Branch coverage
100%
Covered branches: 12
Total branches: 12
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Validate(...)100%1212100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/OptionConfigurators/ValidateGracefulShutdownOptions.cs

#LineLine coverage
 1using Elsa.Workflows.Runtime.Options;
 2using Microsoft.Extensions.Options;
 3
 4// ReSharper disable once CheckNamespace
 5namespace Elsa.Extensions;
 6
 7/// <summary>
 8/// Validates <see cref="GracefulShutdownOptions"/>.
 9/// </summary>
 10public class ValidateGracefulShutdownOptions : IValidateOptions<GracefulShutdownOptions>
 11{
 12    /// <inheritdoc />
 13    public ValidateOptionsResult Validate(string? name, GracefulShutdownOptions options)
 14    {
 9315        var failures = new List<string>();
 16
 9317        if (options.DrainDeadline <= TimeSpan.Zero)
 218            failures.Add($"{nameof(GracefulShutdownOptions.DrainDeadline)} must be greater than zero.");
 19
 9320        if (options.IngressPauseTimeout <= TimeSpan.Zero)
 221            failures.Add($"{nameof(GracefulShutdownOptions.IngressPauseTimeout)} must be greater than zero.");
 22
 9323        if (options.StimulusQueueMaxDepthWhilePaused is <= 0)
 224            failures.Add($"{nameof(GracefulShutdownOptions.StimulusQueueMaxDepthWhilePaused)} must be null (unlimited) o
 25
 9326        if (options.MaxForceCancelledInstanceIdsReported <= 0)
 227            failures.Add($"{nameof(GracefulShutdownOptions.MaxForceCancelledInstanceIdsReported)} must be greater than z
 28
 9329        return failures.Count > 0 ? ValidateOptionsResult.Fail(failures) : ValidateOptionsResult.Success;
 30    }
 31}
 32