This commit is contained in:
StellaOps Bot
2025-12-26 21:43:56 +02:00
354 changed files with 354 additions and 0 deletions

View File

@@ -111,6 +111,7 @@ public sealed class FixtureImpactIndexTests
});
using var _ = loggerFactory;
using StellaOps.TestKit;
var result = await impactIndex.ResolveAllAsync(selector, usageOnly: false);
result.Images.Should().HaveCount(6);

View File

@@ -250,6 +250,7 @@ public sealed class SamplePayloadTests
private static string NormalizeJson(string json)
{
using var document = JsonDocument.Parse(json);
using StellaOps.TestKit;
return JsonSerializer.Serialize(document.RootElement, new JsonSerializerOptions
{
WriteIndented = false

View File

@@ -80,6 +80,7 @@ public sealed class ScheduleSerializationTests
Assert.Equal(jsonA, jsonB);
using var doc = JsonDocument.Parse(jsonA);
using StellaOps.TestKit;
var root = doc.RootElement;
Assert.Equal(SchedulerSchemaVersions.Schedule, root.GetProperty("schemaVersion").GetString());
Assert.Equal("analysis-only", root.GetProperty("mode").GetString());

View File

@@ -210,6 +210,7 @@ public sealed class RedisSchedulerQueueTests : IAsyncLifetime
TimeProvider.System,
async config => (IConnectionMultiplexer)await ConnectionMultiplexer.ConnectAsync(config).ConfigureAwait(false));
using StellaOps.TestKit;
var message = TestData.CreateRunnerMessage();
await queue.EnqueueAsync(message);

View File

@@ -35,6 +35,7 @@ public sealed class SchedulerQueueServiceCollectionExtensionsTests
await using var provider = services.BuildServiceProvider();
using StellaOps.TestKit;
var plannerQueue = provider.GetRequiredService<ISchedulerPlannerQueue>();
var runnerQueue = provider.GetRequiredService<ISchedulerRunnerQueue>();

View File

@@ -79,6 +79,7 @@ public sealed class CartographerWebhookClientTests
var httpClient = new HttpClient(handler);
var options = Microsoft.Extensions.Options.Options.Create(new SchedulerCartographerOptions());
using var loggerFactory = LoggerFactory.Create(builder => builder.AddDebug());
using StellaOps.TestKit;
var client = new CartographerWebhookClient(httpClient, new OptionsMonitorStub<SchedulerCartographerOptions>(options), loggerFactory.CreateLogger<CartographerWebhookClient>());
var job = new GraphOverlayJob(

View File

@@ -127,6 +127,7 @@ public sealed class EventWebhookEndpointTests : IClassFixture<WebApplicationFact
private static string ComputeSignature(string secret, string payload)
{
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
using StellaOps.TestKit;
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(payload));
return "sha256=" + Convert.ToHexString(hash).ToLowerInvariant();
}

View File

@@ -78,6 +78,7 @@ public sealed class FailureSignatureEndpointTests : IClassFixture<SchedulerWebAp
}));
using var client = factory.CreateClient();
using StellaOps.TestKit;
client.DefaultRequestHeaders.Add("X-Tenant-Id", "tenant-failure-signatures");
client.DefaultRequestHeaders.Add("X-Scopes", "scheduler.runs.read");

View File

@@ -103,6 +103,7 @@ public sealed class GraphJobEndpointTests : IClassFixture<SchedulerWebApplicatio
metricsResponse.EnsureSuccessStatusCode();
var metricsJson = await metricsResponse.Content.ReadAsStringAsync();
using var metricsDoc = JsonDocument.Parse(metricsJson);
using StellaOps.TestKit;
var metricsRoot = metricsDoc.RootElement;
Assert.Equal("tenant-bravo", metricsRoot.GetProperty("tenantId").GetString());
Assert.True(metricsRoot.GetProperty("completed").GetInt32() >= 1);

View File

@@ -73,6 +73,7 @@ public sealed class GraphJobEventPublisherTests
var options = Microsoft.Extensions.Options.Options.Create(new SchedulerEventsOptions());
var loggerProvider = new ListLoggerProvider();
using var loggerFactory = LoggerFactory.Create(builder => builder.AddProvider(loggerProvider));
using StellaOps.TestKit;
var publisher = new GraphJobEventPublisher(new OptionsMonitorStub<SchedulerEventsOptions>(options), new ThrowingRedisConnectionFactory(), loggerFactory.CreateLogger<GraphJobEventPublisher>());
var overlayJob = new GraphOverlayJob(

View File

@@ -66,6 +66,7 @@ public sealed class PolicyRunEndpointTests : IClassFixture<WebApplicationFactory
public async Task MissingScopeReturnsForbidden()
{
using var client = _factory.CreateClient();
using StellaOps.TestKit;
client.DefaultRequestHeaders.Add("X-Tenant-Id", "tenant-policy");
var response = await client.GetAsync("/api/v1/scheduler/policy/runs");

View File

@@ -237,6 +237,7 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
var seenHeartbeat = false;
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
using StellaOps.TestKit;
while (!cts.Token.IsCancellationRequested && !(seenRetry && seenInitial && seenQueueLag && seenHeartbeat))
{
var readTask = reader.ReadLineAsync();

View File

@@ -154,6 +154,7 @@ public sealed class PolicySimulationMetricsProviderTests
instrument.Name == "policy_simulation_latency_seconds")
{
meterListener.EnableMeasurementEvents(instrument);
using StellaOps.TestKit;
}
}
};

View File

@@ -269,6 +269,7 @@ public sealed class RunEndpointTests : IClassFixture<WebApplicationFactory<Progr
using var reader = new StreamReader(stream);
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
using StellaOps.TestKit;
var seenRetry = false;
var seenInitial = false;
var seenQueueLag = false;

View File

@@ -58,6 +58,7 @@ public sealed class ScheduleEndpointTests : IClassFixture<WebApplicationFactory<
public async Task PauseAndResumeSchedule()
{
using var client = _factory.CreateClient();
using StellaOps.TestKit;
client.DefaultRequestHeaders.Add("X-Tenant-Id", "tenant-controls");
client.DefaultRequestHeaders.Add("X-Scopes", "scheduler.schedules.write scheduler.schedules.read");

View File

@@ -132,6 +132,7 @@ public sealed class GraphBuildExecutionServiceTests
var cartographer = new StubCartographerBuildClient();
var completion = new RecordingCompletionClient();
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var options = Microsoft.Extensions.Options.Options.Create(new SchedulerWorkerOptions
{
Graph = new SchedulerWorkerOptions.GraphOptions

View File

@@ -125,6 +125,7 @@ public sealed class GraphOverlayExecutionServiceTests
var cartographer = new StubCartographerOverlayClient();
var completion = new RecordingCompletionClient();
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var options = Microsoft.Extensions.Options.Options.Create(new SchedulerWorkerOptions
{
Graph = new SchedulerWorkerOptions.GraphOptions

View File

@@ -97,6 +97,7 @@ public sealed class PlannerBackgroundServiceTests
var targetingService = new StubImpactTargetingService(timeProvider);
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var executionService = new PlannerExecutionService(
scheduleRepository,
repository,

View File

@@ -86,6 +86,7 @@ public sealed class PlannerExecutionServiceTests
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var service = new PlannerExecutionService(
scheduleRepository,
runRepository,

View File

@@ -26,6 +26,7 @@ public sealed class PolicyRunDispatchBackgroundServiceTests
using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(50));
using StellaOps.TestKit;
await service.StartAsync(cts.Token);
await service.StopAsync(CancellationToken.None);

View File

@@ -189,6 +189,7 @@ public sealed class PolicyRunExecutionServiceTests
var options = Microsoft.Extensions.Options.Options.Create(CloneOptions());
var timeProvider = new TestTimeProvider(DateTimeOffset.Parse("2025-10-28T10:00:00Z"));
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var targeting = new StubPolicyRunTargetingService
{
OnEnsureTargets = job => PolicyRunTargetingResult.NoWork(job, "empty")

View File

@@ -38,6 +38,7 @@ public sealed class PolicySimulationWebhookClientTests
{
var handler = new RecordingHandler(new HttpResponseMessage(HttpStatusCode.Accepted));
using var httpClient = new HttpClient(handler);
using StellaOps.TestKit;
var options = CreateOptions(o =>
{
o.Policy.Webhook.Enabled = true;

View File

@@ -114,6 +114,7 @@ public sealed class RunnerExecutionServiceTests
var eventPublisher = new RecordingSchedulerEventPublisher();
using var metrics = new SchedulerWorkerMetrics();
using StellaOps.TestKit;
var service = new RunnerExecutionService(
repository,
new RecordingRunSummaryService(),