Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -23,7 +23,8 @@ public sealed class RuntimeReconciliationTests
|
||||
private const string TestTenant = "tenant-alpha";
|
||||
private const string TestNode = "node-a";
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithNoRuntimeEvents_ReturnsNotFound()
|
||||
{
|
||||
using var factory = new ScannerApplicationFactory();
|
||||
@@ -44,7 +45,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Contains("No runtime events found", payload.ErrorMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithRuntimeEventsButNoSbom_ReturnsNoSbomError()
|
||||
{
|
||||
var mockObjectStore = new InMemoryArtifactObjectStore();
|
||||
@@ -93,7 +95,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Equal(2, payload.Misses.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithHashMatches_ReturnsMatches()
|
||||
{
|
||||
var mockObjectStore = new InMemoryArtifactObjectStore();
|
||||
@@ -183,7 +186,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.All(payload.Matches, m => Assert.Equal("sha256", m.MatchType));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithPathMatches_ReturnsMatches()
|
||||
{
|
||||
var mockObjectStore = new InMemoryArtifactObjectStore();
|
||||
@@ -268,7 +272,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Equal("path", payload.Matches[0].MatchType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithSpecificEventId_UsesSpecifiedEvent()
|
||||
{
|
||||
var mockObjectStore = new InMemoryArtifactObjectStore();
|
||||
@@ -356,7 +361,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Equal(0, payload.MissCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithNonExistentEventId_ReturnsNotFound()
|
||||
{
|
||||
using var factory = new ScannerApplicationFactory();
|
||||
@@ -377,7 +383,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Equal("RUNTIME_EVENT_NOT_FOUND", payload!.ErrorCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithMissingImageDigest_ReturnsBadRequest()
|
||||
{
|
||||
using var factory = new ScannerApplicationFactory();
|
||||
@@ -393,7 +400,8 @@ public sealed class RuntimeReconciliationTests
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ReconcileEndpoint_WithMixedMatchesAndMisses_ReturnsCorrectCounts()
|
||||
{
|
||||
var mockObjectStore = new InMemoryArtifactObjectStore();
|
||||
@@ -587,6 +595,7 @@ public sealed class RuntimeReconciliationTests
|
||||
public Task PutAsync(ArtifactObjectDescriptor descriptor, Stream content, CancellationToken cancellationToken)
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
using StellaOps.TestKit;
|
||||
content.CopyTo(ms);
|
||||
_store[$"{descriptor.Bucket}/{descriptor.Key}"] = ms.ToArray();
|
||||
return Task.CompletedTask;
|
||||
|
||||
Reference in New Issue
Block a user