< Summary

Information
Class: Elsa.Platform.Integration.Options.ElsaPlatformIntegrationOptions
Assembly: Elsa.Platform.Integration
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs
Line coverage
18%
Covered lines: 6
Uncovered lines: 26
Coverable lines: 32
Total lines: 53
Line coverage: 18.7%
Branch coverage
0%
Covered branches: 0
Total branches: 24
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Enabled()100%210%
get_PlatformEndpoint()100%210%
get_WorkspaceId()100%210%
get_EngineId()100%210%
get_EngineSecret()100%210%
get_WorkerId()100%11100%
get_PollInterval()100%11100%
get_ClaimLeaseDuration()100%11100%
get_MaxArtifactBytes()100%11100%
get_ShellOverlayPath()100%11100%
get_Capabilities()100%11100%
Validate()0%600240%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs

#LineLine coverage
 1namespace Elsa.Platform.Integration.Options;
 2
 3public class ElsaPlatformIntegrationOptions
 4{
 5    public const string ConfigurationSection = "Elsa:PlatformIntegration";
 6
 07    public bool Enabled { get; set; }
 8
 09    public Uri? PlatformEndpoint { get; set; }
 10
 011    public Guid WorkspaceId { get; set; }
 12
 013    public Guid EngineId { get; set; }
 14
 015    public string? EngineSecret { get; set; }
 16
 417    public string WorkerId { get; set; } = $"{Environment.MachineName}:{Environment.ProcessId}";
 18
 419    public TimeSpan PollInterval { get; set; } = TimeSpan.FromSeconds(5);
 20
 421    public TimeSpan ClaimLeaseDuration { get; set; } = TimeSpan.FromMinutes(5);
 22
 423    public long MaxArtifactBytes { get; set; } = 4 * 1024 * 1024;
 24
 1025    public string ShellOverlayPath { get; set; } = "platform-shell-overrides.json";
 26
 527    public IReadOnlyList<string> Capabilities { get; set; } = ["loom.recipe.apply"];
 28
 29    public void Validate()
 30    {
 031        if (!Enabled)
 032            return;
 33
 034        if (PlatformEndpoint is null)
 035            throw new InvalidOperationException("Elsa Platform endpoint is required when Platform integration is enabled
 036        if (WorkspaceId == Guid.Empty)
 037            throw new InvalidOperationException("Elsa Platform workspace ID is required when Platform integration is ena
 038        if (EngineId == Guid.Empty)
 039            throw new InvalidOperationException("Elsa Platform engine ID is required when Platform integration is enable
 040        if (string.IsNullOrWhiteSpace(EngineSecret))
 041            throw new InvalidOperationException("Elsa Platform engine secret is required when Platform integration is en
 042        if (string.IsNullOrWhiteSpace(WorkerId))
 043            throw new InvalidOperationException("Elsa Platform worker ID is required when Platform integration is enable
 044        if (PollInterval <= TimeSpan.Zero)
 045            throw new InvalidOperationException("Elsa Platform poll interval must be positive.");
 046        if (ClaimLeaseDuration < TimeSpan.FromSeconds(1) || ClaimLeaseDuration.TotalSeconds > int.MaxValue)
 047            throw new InvalidOperationException("Elsa Platform claim lease duration must be between 1 second and the max
 048        if (MaxArtifactBytes <= 0 || MaxArtifactBytes > Array.MaxLength)
 049            throw new InvalidOperationException("Elsa Platform maximum artifact size must be between 1 byte and the maxi
 050        if (string.IsNullOrWhiteSpace(ShellOverlayPath))
 051            throw new InvalidOperationException("Elsa Platform shell overlay path is required when Platform integration 
 052    }
 53}