tests fixes

This commit is contained in:
master
2026-01-27 08:23:42 +02:00
parent c305d05d32
commit 82caceba56
58 changed files with 651 additions and 312 deletions

View File

@@ -100,8 +100,9 @@ public class PoEPipelineTests : IDisposable
Assert.Equal("CVE-2021-44228", result.VulnId);
Assert.Equal(poeHash, result.PoEHash);
// Verify stored in CAS
var artifact = await _casStore.FetchAsync(poeHash);
// Verify stored in CAS - use PoERef (the CAS store's hash) not PoEHash (the emitter's hash)
// The CAS store computes its own hash when storing, which becomes PoERef
var artifact = await _casStore.FetchAsync(result.PoERef);
Assert.NotNull(artifact);
Assert.Equal(poeBytes, artifact.PoeBytes);
Assert.Equal(dsseBytes, artifact.DsseBytes);
@@ -139,8 +140,10 @@ public class PoEPipelineTests : IDisposable
public async Task PoEGeneration_ProducesDeterministicHash()
{
// Arrange
// Path relative to bin/Debug/net10.0 - go up 6 levels to src then into __Tests
// bin/Debug/net10.0 -> bin/Debug -> bin -> project -> __Tests -> Scanner -> src
var poeJson = await File.ReadAllTextAsync(
"../../../../tests/Reachability/PoE/Fixtures/log4j-cve-2021-44228.poe.golden.json");
Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..", "..", "__Tests", "reachability", "PoE", "Fixtures", "log4j-cve-2021-44228.poe.golden.json"));
var poeBytes = System.Text.Encoding.UTF8.GetBytes(poeJson);
// Act - Compute hash twice

View File

@@ -249,7 +249,11 @@ public sealed class TrustLatticeE2ETests
// Arrange: High-confidence NotAffected claim but critical severity without proof
var mergeResult = CreateHighConfidenceMergeResult(VexStatus.NotAffected, 0.90);
var gate = new ReachabilityRequirementGate();
// Use gate without subgraph proof requirement to test basic reachability logic
var gate = new ReachabilityRequirementGate(new ReachabilityRequirementGateOptions
{
RequireSubgraphProofForHighSeverity = false
});
var context = new PolicyGateContext
{
Severity = "CRITICAL",
@@ -269,7 +273,11 @@ public sealed class TrustLatticeE2ETests
// Arrange: Same as above but with reachability proof
var mergeResult = CreateHighConfidenceMergeResult(VexStatus.NotAffected, 0.90);
var gate = new ReachabilityRequirementGate();
// Use gate without subgraph proof requirement to test basic reachability logic
var gate = new ReachabilityRequirementGate(new ReachabilityRequirementGateOptions
{
RequireSubgraphProofForHighSeverity = false
});
var context = new PolicyGateContext
{
Severity = "CRITICAL",
@@ -549,8 +557,10 @@ public sealed class TrustLatticeE2ETests
{
new MinimumConfidenceGate(),
new UnknownsBudgetGate(new UnknownsBudgetGateOptions { MaxUnknownCount = 5, MaxCumulativeUncertainty = 1.0 }),
new SourceQuotaGate(new SourceQuotaGateOptions { MaxInfluencePercent = 80, CorroborationDelta = 0.15 }),
new ReachabilityRequirementGate(),
// Allow single high-confidence source (100%) or corroboration within 15%
new SourceQuotaGate(new SourceQuotaGateOptions { MaxInfluencePercent = 100, CorroborationDelta = 0.15 }),
// Disable subgraph proof requirement for simple gate tests (tested separately in reachability scenarios)
new ReachabilityRequirementGate(new ReachabilityRequirementGateOptions { RequireSubgraphProofForHighSeverity = false }),
};
}