39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.IO;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using StellaOps.Bench.Notify.Baseline;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Bench.Notify.Tests;
|
|
|
|
public sealed class BaselineLoaderTests
|
|
{
|
|
[Fact]
|
|
public async Task LoadAsync_ReadsBaselineEntries()
|
|
{
|
|
var path = Path.GetTempFileName();
|
|
try
|
|
{
|
|
await File.WriteAllTextAsync(
|
|
path,
|
|
"scenario,iterations,events,deliveries,mean_ms,p95_ms,max_ms,mean_throughput_per_sec,min_throughput_per_sec,max_allocated_mb\n" +
|
|
"notify_dispatch_density_05,5,5000,25000,120.5,150.1,199.9,42000.5,39000.2,85.7\n");
|
|
|
|
var entries = await BaselineLoader.LoadAsync(path, CancellationToken.None);
|
|
var entry = Assert.Single(entries);
|
|
|
|
Assert.Equal("notify_dispatch_density_05", entry.Key);
|
|
Assert.Equal(5, entry.Value.Iterations);
|
|
Assert.Equal(5000, entry.Value.EventCount);
|
|
Assert.Equal(25000, entry.Value.DeliveryCount);
|
|
Assert.Equal(120.5, entry.Value.MeanMs);
|
|
Assert.Equal(39000.2, entry.Value.MinThroughputPerSecond);
|
|
Assert.Equal(85.7, entry.Value.MaxAllocatedMb);
|
|
}
|
|
finally
|
|
{
|
|
File.Delete(path);
|
|
}
|
|
}
|
|
}
|