Refactor code structure and optimize performance across multiple modules

This commit is contained in:
StellaOps Bot
2025-12-26 20:03:22 +02:00
parent c786faae84
commit f10d83c444
1385 changed files with 69732 additions and 10280 deletions

View File

@@ -11,11 +11,13 @@ using StellaOps.Scheduler.Worker.Options;
using StellaOps.Scheduler.Worker.Policy;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Scheduler.Worker.Tests;
public sealed class PolicyRunTargetingServiceTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_ReturnsUnchanged_ForNonIncrementalJob()
{
var service = CreateService();
@@ -27,7 +29,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal(job, result.Job);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_ReturnsUnchanged_WhenSbomSetAlreadyPresent()
{
var service = CreateService();
@@ -39,7 +42,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal(PolicyRunTargetingStatus.Unchanged, result.Status);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_ReturnsNoWork_WhenNoCandidatesResolved()
{
var impact = new StubImpactTargetingService();
@@ -53,7 +57,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal("no_matches", result.Reason);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_TargetsDirectSboms()
{
var service = CreateService();
@@ -66,7 +71,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal(new[] { "sbom:S-1", "sbom:S-2" }, result.Job.Inputs.SbomSet);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_TargetsUsingImpactIndex()
{
var impact = new StubImpactTargetingService
@@ -100,7 +106,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal(new[] { "sbom:S-42" }, result.Job.Inputs.SbomSet);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_FallsBack_WhenLimitExceeded()
{
var service = CreateService(configure: options => options.MaxSboms = 1);
@@ -112,7 +119,8 @@ public sealed class PolicyRunTargetingServiceTests
Assert.Equal(PolicyRunTargetingStatus.Unchanged, result.Status);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task EnsureTargetsAsync_FallbacksToDigest_WhenLabelMissing()
{
var impact = new StubImpactTargetingService