feat: execute full-repo remaining parity closure plan
This commit is contained in:
14
tests/NATS.Server.Tests/Routes/RouteAccountScopedTests.cs
Normal file
14
tests/NATS.Server.Tests/Routes/RouteAccountScopedTests.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using NATS.Server.Routes;
|
||||
|
||||
namespace NATS.Server.Tests;
|
||||
|
||||
public class RouteAccountScopedTests
|
||||
{
|
||||
[Fact]
|
||||
public void Route_connect_info_includes_account_scope()
|
||||
{
|
||||
var json = RouteConnection.BuildConnectInfoJson("S1", ["A"], "topology-v1");
|
||||
json.ShouldContain("\"accounts\":[\"A\"]");
|
||||
json.ShouldContain("\"topology\":\"topology-v1\"");
|
||||
}
|
||||
}
|
||||
16
tests/NATS.Server.Tests/Routes/RouteCompressionTests.cs
Normal file
16
tests/NATS.Server.Tests/Routes/RouteCompressionTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Text;
|
||||
using NATS.Server.Routes;
|
||||
|
||||
namespace NATS.Server.Tests;
|
||||
|
||||
public class RouteCompressionTests
|
||||
{
|
||||
[Fact]
|
||||
public void Route_payload_round_trips_through_compression_codec()
|
||||
{
|
||||
var payload = Encoding.UTF8.GetBytes(new string('x', 512));
|
||||
var compressed = RouteCompressionCodec.Compress(payload);
|
||||
var restored = RouteCompressionCodec.Decompress(compressed);
|
||||
restored.ShouldBe(payload);
|
||||
}
|
||||
}
|
||||
25
tests/NATS.Server.Tests/Routes/RouteTopologyGossipTests.cs
Normal file
25
tests/NATS.Server.Tests/Routes/RouteTopologyGossipTests.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using NATS.Server.Configuration;
|
||||
using NATS.Server.Routes;
|
||||
|
||||
namespace NATS.Server.Tests;
|
||||
|
||||
public class RouteTopologyGossipTests
|
||||
{
|
||||
[Fact]
|
||||
public void Topology_snapshot_reports_server_and_route_counts()
|
||||
{
|
||||
var manager = new RouteManager(
|
||||
new ClusterOptions { Host = "127.0.0.1", Port = 0 },
|
||||
new ServerStats(),
|
||||
"S1",
|
||||
_ => { },
|
||||
_ => { },
|
||||
NullLogger<RouteManager>.Instance);
|
||||
|
||||
var snapshot = manager.BuildTopologySnapshot();
|
||||
snapshot.ServerId.ShouldBe("S1");
|
||||
snapshot.RouteCount.ShouldBe(0);
|
||||
snapshot.ConnectedServerIds.ShouldBeEmpty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user