up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
devportal-offline / build-offline (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-03 00:10:19 +02:00
parent ea1d58a89b
commit 37cba83708
158 changed files with 147438 additions and 867 deletions

View File

@@ -0,0 +1,39 @@
using System;
using StellaOps.Policy.Engine.ConsoleSurface;
using StellaOps.Policy.Engine.Simulation;
using Xunit;
namespace StellaOps.Policy.Engine.Tests.ConsoleSurface;
public sealed class ConsoleSimulationDiffServiceTests
{
[Fact]
public void Compute_IsDeterministic_AndCarriesMetadata()
{
var analytics = new SimulationAnalyticsService();
var service = new ConsoleSimulationDiffService(analytics);
var request = new ConsoleSimulationDiffRequest(
BaselinePolicyVersion: "2025.11.24",
CandidatePolicyVersion: "2025.12.02",
ArtifactScope: new[]
{
new ConsoleArtifactScope("sha256:abc", "pkg:npm/foo@1.0.0"),
new ConsoleArtifactScope("sha256:def", "pkg:npm/bar@2.0.0")
},
Filters: new ConsoleSimulationFilters(new[] { "high", "critical" }, new[] { "RULE-1234" }),
Budget: new ConsoleSimulationBudget(maxFindings: 10, maxExplainSamples: 5),
EvaluationTimestamp: new DateTimeOffset(2025, 12, 2, 0, 0, 0, TimeSpan.Zero));
var first = service.Compute(request);
var second = service.Compute(request);
Assert.Equal(first, second); // deterministic
Assert.Equal("console-policy-23-001", first.SchemaVersion);
Assert.True(first.Summary.After.Total > 0);
Assert.True(first.Summary.Before.Total > 0);
Assert.NotEmpty(first.RuleImpact);
Assert.True(first.Samples.Findings.Length <= 10);
Assert.Equal(request.EvaluationTimestamp, first.Provenance.EvaluationTimestamp);
}
}