feat(batch14): complete filestore write lifecycle features and tests

This commit is contained in:
Joseph Doherty
2026-02-28 16:41:31 -05:00
parent 045faf7423
commit 5367c3f34d
9 changed files with 1596 additions and 39 deletions

View File

@@ -0,0 +1,77 @@
using Shouldly;
using ZB.MOM.NatsNet.Server;
namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
public sealed partial class RouteHandlerTests
{
[Fact] // T:2854
public void RouteCompressionAuto_ShouldSucceed()
{
var errors = new List<Exception>();
var warnings = new List<Exception>();
var options = new ServerOptions();
var parseError = ServerOptions.ParseCluster(
new Dictionary<string, object?>
{
["name"] = "local",
["compression"] = new Dictionary<string, object?>
{
["mode"] = CompressionModes.S2Auto,
["rtt_thresholds"] = new List<object?> { "100ms", "200ms", "300ms" },
},
},
options,
errors,
warnings);
parseError.ShouldBeNull();
errors.ShouldBeEmpty();
options.Cluster.Compression.Mode.ShouldBe(CompressionModes.S2Auto);
options.Cluster.Compression.RttThresholds.Count.ShouldBe(3);
options.Cluster.Compression.RttThresholds[0].ShouldBe(TimeSpan.FromMilliseconds(100));
options.Cluster.Compression.RttThresholds[1].ShouldBe(TimeSpan.FromMilliseconds(200));
options.Cluster.Compression.RttThresholds[2].ShouldBe(TimeSpan.FromMilliseconds(300));
options = new ServerOptions();
errors.Clear();
warnings.Clear();
parseError = ServerOptions.ParseCluster(
new Dictionary<string, object?>
{
["compression"] = new Dictionary<string, object?>
{
["mode"] = CompressionModes.S2Auto,
["rtt_thresholds"] = new List<object?> { "0ms", "100ms", "0ms", "300ms" },
},
},
options,
errors,
warnings);
parseError.ShouldBeNull();
errors.ShouldBeEmpty();
options.Cluster.Compression.RttThresholds.Count.ShouldBe(4);
options.Cluster.Compression.RttThresholds[0].ShouldBe(TimeSpan.Zero);
options.Cluster.Compression.RttThresholds[1].ShouldBe(TimeSpan.FromMilliseconds(100));
options.Cluster.Compression.RttThresholds[2].ShouldBe(TimeSpan.Zero);
options.Cluster.Compression.RttThresholds[3].ShouldBe(TimeSpan.FromMilliseconds(300));
options = new ServerOptions();
errors.Clear();
warnings.Clear();
parseError = ServerOptions.ParseCluster(
new Dictionary<string, object?>
{
["compression"] = false,
},
options,
errors,
warnings);
parseError.ShouldBeNull();
errors.ShouldBeEmpty();
options.Cluster.Compression.Mode.ShouldBe(CompressionModes.Off);
}
}