Merge all changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
using Xunit;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@@ -103,7 +104,7 @@ public sealed class RuntimeEndpointsTests
|
||||
|
||||
using var scope = factory.Services.CreateScope();
|
||||
var repository = scope.ServiceProvider.GetRequiredService<RuntimeEventRepository>();
|
||||
var count = await repository.CountAsync(CancellationToken.None);
|
||||
var count = await repository.CountAsync(TestContext.Current.CancellationToken);
|
||||
Assert.Equal(0, count);
|
||||
}
|
||||
|
||||
@@ -126,7 +127,7 @@ public sealed class RuntimeEndpointsTests
|
||||
var links = scope.ServiceProvider.GetRequiredService<LinkRepository>();
|
||||
var policyStore = scope.ServiceProvider.GetRequiredService<PolicySnapshotStore>();
|
||||
var runtimeRepository = scope.ServiceProvider.GetRequiredService<RuntimeEventRepository>();
|
||||
await runtimeRepository.TruncateAsync(CancellationToken.None);
|
||||
await runtimeRepository.TruncateAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
const string policyYaml = """
|
||||
version: "1.0"
|
||||
@@ -137,10 +138,10 @@ rules:
|
||||
""";
|
||||
var saveResult = await policyStore.SaveAsync(
|
||||
new PolicySnapshotContent(policyYaml, PolicyDocumentFormat.Yaml, "tester", "tests", "seed"),
|
||||
CancellationToken.None);
|
||||
TestContext.Current.CancellationToken);
|
||||
Assert.True(saveResult.Success);
|
||||
|
||||
var snapshot = await policyStore.GetLatestAsync(CancellationToken.None);
|
||||
var snapshot = await policyStore.GetLatestAsync(TestContext.Current.CancellationToken);
|
||||
Assert.NotNull(snapshot);
|
||||
|
||||
var sbomArtifactId = CatalogIdFactory.CreateArtifactId(ArtifactDocumentType.ImageBom, "sha256:sbomdigest");
|
||||
@@ -154,7 +155,7 @@ rules:
|
||||
MediaType = "application/json",
|
||||
BytesSha256 = "sha256:sbomdigest",
|
||||
RefCount = 1
|
||||
}, CancellationToken.None);
|
||||
}, TestContext.Current.CancellationToken);
|
||||
|
||||
await artifacts.UpsertAsync(new ArtifactDocument
|
||||
{
|
||||
@@ -165,7 +166,7 @@ rules:
|
||||
BytesSha256 = "sha256:attdigest",
|
||||
RefCount = 1,
|
||||
Rekor = new RekorReference { Uuid = "rekor-uuid", Url = "https://rekor.example/uuid/rekor-uuid", Index = 7 }
|
||||
}, CancellationToken.None);
|
||||
}, TestContext.Current.CancellationToken);
|
||||
|
||||
await links.UpsertAsync(new LinkDocument
|
||||
{
|
||||
@@ -174,7 +175,7 @@ rules:
|
||||
FromDigest = imageDigest,
|
||||
ArtifactId = sbomArtifactId,
|
||||
CreatedAtUtc = DateTime.UtcNow
|
||||
}, CancellationToken.None);
|
||||
}, TestContext.Current.CancellationToken);
|
||||
|
||||
await links.UpsertAsync(new LinkDocument
|
||||
{
|
||||
@@ -183,7 +184,7 @@ rules:
|
||||
FromDigest = imageDigest,
|
||||
ArtifactId = attestationArtifactId,
|
||||
CreatedAtUtc = DateTime.UtcNow
|
||||
}, CancellationToken.None);
|
||||
}, TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
var ingestRequest = new RuntimeEventsIngestRequestDto
|
||||
@@ -257,10 +258,10 @@ rules: []
|
||||
""";
|
||||
await policyStore.SaveAsync(
|
||||
new PolicySnapshotContent(policyYaml, PolicyDocumentFormat.Yaml, "tester", "tests", "baseline"),
|
||||
CancellationToken.None);
|
||||
TestContext.Current.CancellationToken);
|
||||
|
||||
// Intentionally skip artifacts/links to simulate missing metadata.
|
||||
await runtimeRepository.TruncateAsync(CancellationToken.None);
|
||||
await runtimeRepository.TruncateAsync(TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
var response = await client.PostAsJsonAsync("/api/v1/policy/runtime", new RuntimePolicyRequestDto
|
||||
|
||||
Reference in New Issue
Block a user