- 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.
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System.Text;
|
|
using StellaOps.Bench.ScannerAnalyzers.Baseline;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Bench.ScannerAnalyzers.Tests;
|
|
|
|
public sealed class BaselineLoaderTests
|
|
{
|
|
[Fact]
|
|
public async Task LoadAsync_ReadsCsvIntoDictionary()
|
|
{
|
|
var csv = """
|
|
scenario,iterations,sample_count,mean_ms,p95_ms,max_ms
|
|
node_monorepo_walk,5,4,9.4303,36.1354,45.0012
|
|
python_site_packages_walk,5,10,12.1000,18.2000,26.3000
|
|
""";
|
|
|
|
var path = await WriteTempFileAsync(csv);
|
|
|
|
var result = await BaselineLoader.LoadAsync(path, CancellationToken.None);
|
|
|
|
Assert.Equal(2, result.Count);
|
|
var entry = Assert.Contains("node_monorepo_walk", result);
|
|
Assert.Equal(5, entry.Iterations);
|
|
Assert.Equal(4, entry.SampleCount);
|
|
Assert.Equal(9.4303, entry.MeanMs, 4);
|
|
Assert.Equal(36.1354, entry.P95Ms, 4);
|
|
Assert.Equal(45.0012, entry.MaxMs, 4);
|
|
}
|
|
|
|
private static async Task<string> WriteTempFileAsync(string content)
|
|
{
|
|
var path = Path.Combine(Path.GetTempPath(), $"baseline-{Guid.NewGuid():N}.csv");
|
|
await File.WriteAllTextAsync(path, content, Encoding.UTF8);
|
|
return path;
|
|
}
|
|
}
|