fix tests. new product advisories enhancements

This commit is contained in:
master
2026-01-25 19:11:36 +02:00
parent c70e83719e
commit 6e687b523a
504 changed files with 40610 additions and 3785 deletions

View File

@@ -127,9 +127,9 @@ public sealed class CveSymbolMappingServiceTests
var symbol = mapping.ToVulnerableSymbol();
Assert.Equal("vulnerable_function", symbol.Name);
Assert.Equal("org.test.Vuln#vulnerable_function()", symbol.Name);
Assert.Equal("CVE-2024-1234", symbol.VulnerabilityId);
Assert.Equal(SymbolType.Function, symbol.Type);
Assert.Equal(SymbolType.JavaMethod, symbol.Type);
}
private static CveSinkMapping CreateMapping(

View File

@@ -214,7 +214,7 @@ public sealed class PostgresObservationStoreIntegrationTests : IAsyncLifetime
now.AddMinutes(2),
ct: CancellationToken.None);
containerResults.Should().HaveCountGreaterOrEqualTo(3);
containerResults.Should().HaveCountGreaterThanOrEqualTo(3);
containerResults.Should().AllSatisfy(o => o.ContainerId.Should().Be(containerId));
}
}

View File

@@ -9,9 +9,11 @@ using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Net.Http.Json;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Fm = StellaOps.Scanner.Reachability.FunctionMap;
namespace StellaOps.Scanner.Reachability.Tests.FunctionMap;
@@ -121,20 +123,20 @@ public sealed class RekorIntegrationTests
var entry = enumerator.Current.Value;
entry.TryGetProperty("logIndex", out var logIndex).Should().BeTrue();
logIndex.GetInt64().Should().BeGreaterOrEqualTo(0);
logIndex.GetInt64().Should().BeGreaterThanOrEqualTo(0);
entry.TryGetProperty("verification", out var verification).Should().BeTrue();
verification.TryGetProperty("inclusionProof", out var proof).Should().BeTrue();
proof.TryGetProperty("hashes", out var hashes).Should().BeTrue();
hashes.GetArrayLength().Should().BeGreaterOrEqualTo(0);
hashes.GetArrayLength().Should().BeGreaterThanOrEqualTo(0);
}
private static FunctionMap.FunctionMapPredicate CreateTestPredicate()
private static Fm.FunctionMapPredicate CreateTestPredicate()
{
return new FunctionMap.FunctionMapPredicate
return new Fm.FunctionMapPredicate
{
Type = "https://stellaops.io/attestation/function-map/v1",
Subject = new FunctionMap.FunctionMapSubject
Subject = new Fm.FunctionMapSubject
{
Purl = "pkg:oci/test-service@sha256:abcdef1234567890",
Digest = new Dictionary<string, string>
@@ -142,31 +144,31 @@ public sealed class RekorIntegrationTests
["sha256"] = "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
},
Predicate = new FunctionMap.FunctionMapPredicateBody
Predicate = new Fm.FunctionMapPredicatePayload
{
SchemaVersion = "1.0.0",
Service = "test-service",
GeneratedAt = DateTimeOffset.UtcNow,
BuildId = "test-build-001",
Coverage = new FunctionMap.CoveragePolicy
Coverage = new Fm.CoverageThresholds
{
MinObservationRate = 0.95,
WindowSeconds = 1800,
FailOnUnexpected = false
},
ExpectedPaths = new List<FunctionMap.ExpectedPath>
ExpectedPaths = new List<Fm.ExpectedPath>
{
new()
{
PathId = "ssl-handshake",
Description = "TLS handshake path",
Entrypoint = new FunctionMap.PathEntrypoint
Entrypoint = new Fm.PathEntrypoint
{
Symbol = "SSL_do_handshake",
NodeHash = "node_abc123"
},
PathHash = "path_hash_001",
ExpectedCalls = new List<FunctionMap.ExpectedCall>
ExpectedCalls = new List<Fm.ExpectedCall>
{
new()
{

View File

@@ -14,7 +14,6 @@
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" />
<PackageReference Include="Moq" />
<PackageReference Include="Npgsql" />
<PackageReference Include="xunit.v3" />
</ItemGroup>
<ItemGroup>