- Implemented RustFsArtifactObjectStore for managing artifacts in RustFS. - Added unit tests for RustFsArtifactObjectStore functionality. - Created a RustFS migrator tool to transfer objects from S3 to RustFS. - Introduced policy preview and report models for API integration. - Added fixtures and tests for policy preview and report functionality. - Included necessary metadata and scripts for cache_pkg package.
59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using StellaOps.Bench.ScannerAnalyzers;
|
|
using StellaOps.Bench.ScannerAnalyzers.Baseline;
|
|
using StellaOps.Bench.ScannerAnalyzers.Reporting;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Bench.ScannerAnalyzers.Tests;
|
|
|
|
public sealed class BenchmarkScenarioReportTests
|
|
{
|
|
[Fact]
|
|
public void RegressionRatio_ComputedWhenBaselinePresent()
|
|
{
|
|
var result = new ScenarioResult(
|
|
"scenario",
|
|
"Scenario",
|
|
SampleCount: 5,
|
|
MeanMs: 10,
|
|
P95Ms: 12,
|
|
MaxMs: 20,
|
|
Iterations: 5,
|
|
ThresholdMs: 5000);
|
|
|
|
var baseline = new BaselineEntry(
|
|
"scenario",
|
|
Iterations: 5,
|
|
SampleCount: 5,
|
|
MeanMs: 8,
|
|
P95Ms: 11,
|
|
MaxMs: 15);
|
|
|
|
var report = new BenchmarkScenarioReport(result, baseline, regressionLimit: 1.2);
|
|
|
|
Assert.True(report.MaxRegressionRatio.HasValue);
|
|
Assert.Equal(20d / 15d, report.MaxRegressionRatio.Value, 6);
|
|
Assert.True(report.RegressionBreached);
|
|
Assert.Contains("+33.3%", report.BuildRegressionFailureMessage());
|
|
}
|
|
|
|
[Fact]
|
|
public void RegressionRatio_NullWhenBaselineMissing()
|
|
{
|
|
var result = new ScenarioResult(
|
|
"scenario",
|
|
"Scenario",
|
|
SampleCount: 5,
|
|
MeanMs: 10,
|
|
P95Ms: 12,
|
|
MaxMs: 20,
|
|
Iterations: 5,
|
|
ThresholdMs: 5000);
|
|
|
|
var report = new BenchmarkScenarioReport(result, baseline: null, regressionLimit: 1.2);
|
|
|
|
Assert.Null(report.MaxRegressionRatio);
|
|
Assert.False(report.RegressionBreached);
|
|
Assert.Null(report.BuildRegressionFailureMessage());
|
|
}
|
|
}
|