Add Policy DSL Validator, Schema Exporter, and Simulation Smoke tools
- Implemented PolicyDslValidator with command-line options for strict mode and JSON output. - Created PolicySchemaExporter to generate JSON schemas for policy-related models. - Developed PolicySimulationSmoke tool to validate policy simulations against expected outcomes. - Added project files and necessary dependencies for each tool. - Ensured proper error handling and usage instructions across tools.
This commit is contained in:
		@@ -0,0 +1,38 @@
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using StellaOps.Bench.LinkNotMerge.Baseline;
 | 
			
		||||
using Xunit;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Bench.LinkNotMerge.Tests;
 | 
			
		||||
 | 
			
		||||
public sealed class BaselineLoaderTests
 | 
			
		||||
{
 | 
			
		||||
    [Fact]
 | 
			
		||||
    public async Task LoadAsync_ReadsEntries()
 | 
			
		||||
    {
 | 
			
		||||
        var path = Path.GetTempFileName();
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await File.WriteAllTextAsync(
 | 
			
		||||
                path,
 | 
			
		||||
                "scenario,iterations,observations,aliases,linksets,mean_total_ms,p95_total_ms,max_total_ms,mean_insert_ms,mean_correlation_ms,mean_throughput_per_sec,min_throughput_per_sec,mean_mongo_throughput_per_sec,min_mongo_throughput_per_sec,max_allocated_mb\n" +
 | 
			
		||||
                "lnm_ingest_baseline,5,5000,500,450,320.5,340.1,360.9,120.2,210.3,15000.0,13500.0,18000.0,16500.0,96.5\n");
 | 
			
		||||
 | 
			
		||||
            var baseline = await BaselineLoader.LoadAsync(path, CancellationToken.None);
 | 
			
		||||
            var entry = Assert.Single(baseline);
 | 
			
		||||
 | 
			
		||||
            Assert.Equal("lnm_ingest_baseline", entry.Key);
 | 
			
		||||
            Assert.Equal(5, entry.Value.Iterations);
 | 
			
		||||
            Assert.Equal(5000, entry.Value.Observations);
 | 
			
		||||
            Assert.Equal(500, entry.Value.Aliases);
 | 
			
		||||
            Assert.Equal(360.9, entry.Value.MaxTotalMs);
 | 
			
		||||
            Assert.Equal(16500.0, entry.Value.MinMongoThroughputPerSecond);
 | 
			
		||||
            Assert.Equal(96.5, entry.Value.MaxAllocatedMb);
 | 
			
		||||
        }
 | 
			
		||||
        finally
 | 
			
		||||
        {
 | 
			
		||||
            File.Delete(path);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user