feat: Add RustFS artifact object store and migration tool
- 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.
This commit is contained in:
		@@ -0,0 +1,32 @@
 | 
			
		||||
using StellaOps.Bench.ScannerAnalyzers;
 | 
			
		||||
using StellaOps.Bench.ScannerAnalyzers.Baseline;
 | 
			
		||||
using StellaOps.Bench.ScannerAnalyzers.Reporting;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Bench.ScannerAnalyzers.Tests;
 | 
			
		||||
 | 
			
		||||
public sealed class PrometheusWriterTests
 | 
			
		||||
{
 | 
			
		||||
    [Fact]
 | 
			
		||||
    public void Write_EmitsMetricsForScenario()
 | 
			
		||||
    {
 | 
			
		||||
        var result = new ScenarioResult(
 | 
			
		||||
            "scenario_a",
 | 
			
		||||
            "Scenario A",
 | 
			
		||||
            SampleCount: 5,
 | 
			
		||||
            MeanMs: 10,
 | 
			
		||||
            P95Ms: 12,
 | 
			
		||||
            MaxMs: 20,
 | 
			
		||||
            Iterations: 5,
 | 
			
		||||
            ThresholdMs: 5000);
 | 
			
		||||
        var baseline = new BaselineEntry("scenario_a", 5, 5, 9, 11, 18);
 | 
			
		||||
        var report = new BenchmarkScenarioReport(result, baseline, 1.2);
 | 
			
		||||
 | 
			
		||||
        var path = Path.Combine(Path.GetTempPath(), $"metrics-{Guid.NewGuid():N}.prom");
 | 
			
		||||
        PrometheusWriter.Write(path, new[] { report });
 | 
			
		||||
 | 
			
		||||
        var contents = File.ReadAllText(path);
 | 
			
		||||
        Assert.Contains("scanner_analyzer_bench_max_ms{scenario=\"scenario_a\"} 20", contents);
 | 
			
		||||
        Assert.Contains("scanner_analyzer_bench_regression_ratio{scenario=\"scenario_a\"}", contents);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user