release orchestration strengthening
This commit is contained in:
@@ -277,11 +277,10 @@ public sealed class ProvenanceHintSerializationTests
|
||||
|
||||
// Act
|
||||
var json = JsonSerializer.Serialize(hint, JsonOptions);
|
||||
|
||||
// Assert - JSON is parseable
|
||||
var parsed = JsonDocument.Parse(json);
|
||||
parsed.RootElement.GetProperty("hint_id").GetString().Should().StartWith("hint:sha256:");
|
||||
parsed.RootElement.GetProperty("type").GetString().Should().NotBeNullOrEmpty();
|
||||
parsed.RootElement.GetProperty("type").GetInt32().Should().Be((int)ProvenanceHintType.BuildIdMatch);
|
||||
parsed.RootElement.GetProperty("confidence").GetDouble().Should().BeInRange(0, 1);
|
||||
parsed.RootElement.GetProperty("evidence").GetProperty("build_id").GetProperty("catalog_source")
|
||||
.GetString().Should().Be("debian-security");
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StellaOps.Unknowns.Core.Models;
|
||||
using StellaOps.Unknowns.Core.Repositories;
|
||||
@@ -24,10 +25,24 @@ public sealed class UnknownsEndpointsTests : IClassFixture<WebApplicationFactory
|
||||
|
||||
public UnknownsEndpointsTests(WebApplicationFactory<Program> factory)
|
||||
{
|
||||
Environment.SetEnvironmentVariable(
|
||||
"ConnectionStrings__UnknownsDb",
|
||||
"Host=localhost;Database=unknowns_test;Username=test;Password=test");
|
||||
|
||||
_mockRepository = Substitute.For<IUnknownRepository>();
|
||||
|
||||
_factory = factory.WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.ConfigureAppConfiguration((_, config) =>
|
||||
{
|
||||
var settings = new Dictionary<string, string?>
|
||||
{
|
||||
["ConnectionStrings:UnknownsDb"] =
|
||||
"Host=localhost;Database=unknowns_test;Username=test;Password=test"
|
||||
};
|
||||
config.AddInMemoryCollection(settings);
|
||||
});
|
||||
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
// Remove existing repository registration
|
||||
@@ -336,20 +351,35 @@ public sealed class UnknownsEndpointsTests : IClassFixture<WebApplicationFactory
|
||||
ProvenanceHints = [
|
||||
new ProvenanceHint
|
||||
{
|
||||
Id = $"hint:{Guid.NewGuid():N}",
|
||||
HintId = $"hint:sha256:{Guid.NewGuid():N}",
|
||||
Type = ProvenanceHintType.BuildIdMatch,
|
||||
Confidence = 0.85,
|
||||
ConfidenceLevel = HintConfidence.High,
|
||||
Summary = "Build-ID match from Debian",
|
||||
Hypothesis = "Likely debian:bookworm backport",
|
||||
Evidence = new ProvenanceEvidence
|
||||
{
|
||||
BuildId = new BuildIdEvidence
|
||||
{
|
||||
BuildId = "deadbeef0123456789abcdef",
|
||||
BuildIdType = "sha256",
|
||||
MatchedPackage = "openssl",
|
||||
MatchedVersion = "3.0.0",
|
||||
MatchedDistro = "debian",
|
||||
CatalogSource = "debian-security"
|
||||
}
|
||||
},
|
||||
SuggestedActions = [
|
||||
new SuggestedAction
|
||||
{
|
||||
Action = "Verify debian package version",
|
||||
Priority = 1,
|
||||
Effort = "low",
|
||||
Description = "Check against Debian security tracker"
|
||||
}
|
||||
],
|
||||
GeneratedAt = now.AddDays(-3)
|
||||
GeneratedAt = now.AddDays(-3),
|
||||
Source = "BuildIdAnalyzer"
|
||||
}
|
||||
],
|
||||
BestHypothesis = "Likely debian:bookworm backport",
|
||||
|
||||
Reference in New Issue
Block a user