Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Added `SchedulerWorkerOptions` class to encapsulate configuration for the scheduler worker. - Introduced `PlannerBackgroundService` to manage the planner loop, fetching and processing planning runs. - Created `PlannerExecutionService` to handle the execution logic for planning runs, including impact targeting and run persistence. - Developed `PlannerExecutionResult` and `PlannerExecutionStatus` to standardize execution outcomes. - Implemented validation logic within `SchedulerWorkerOptions` to ensure proper configuration. - Added documentation for the planner loop and impact targeting features. - Established health check endpoints and authentication mechanisms for the Signals service. - Created unit tests for the Signals API to ensure proper functionality and response handling. - Configured options for authority integration and fallback authentication methods.
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using StellaOps.Auth.Abstractions;
|
|
using StellaOps.Cartographer.Options;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Cartographer.Tests.Options;
|
|
|
|
public class CartographerAuthorityOptionsConfiguratorTests
|
|
{
|
|
[Fact]
|
|
public void ApplyDefaults_AddsGraphScopes()
|
|
{
|
|
var options = new CartographerAuthorityOptions();
|
|
|
|
CartographerAuthorityOptionsConfigurator.ApplyDefaults(options);
|
|
|
|
Assert.Contains(StellaOpsScopes.GraphRead, options.RequiredScopes);
|
|
Assert.Contains(StellaOpsScopes.GraphWrite, options.RequiredScopes);
|
|
}
|
|
|
|
[Fact]
|
|
public void ApplyDefaults_DoesNotDuplicateScopes()
|
|
{
|
|
var options = new CartographerAuthorityOptions();
|
|
options.RequiredScopes.Add("GRAPH:READ");
|
|
options.RequiredScopes.Add(StellaOpsScopes.GraphWrite);
|
|
|
|
CartographerAuthorityOptionsConfigurator.ApplyDefaults(options);
|
|
|
|
Assert.Equal(2, options.RequiredScopes.Count);
|
|
}
|
|
|
|
[Fact]
|
|
public void Validate_AllowsDisabledConfiguration()
|
|
{
|
|
var options = new CartographerAuthorityOptions();
|
|
|
|
options.Validate(); // should not throw when disabled
|
|
}
|
|
|
|
[Fact]
|
|
public void Validate_ThrowsForInvalidIssuer()
|
|
{
|
|
var options = new CartographerAuthorityOptions
|
|
{
|
|
Enabled = true,
|
|
Issuer = "invalid"
|
|
};
|
|
|
|
Assert.Throws<InvalidOperationException>(() => options.Validate());
|
|
}
|
|
}
|