Move 29 clustering/routing test files from NATS.Server.Tests to a dedicated NATS.Server.Clustering.Tests project. Update namespaces, replace private GetFreePort/ReadUntilAsync helpers with TestUtilities calls, and extract TestServerFactory/ClusterTestServer to TestUtilities to fix cross-project reference from JetStreamStartupTests.
26 lines
846 B
C#
26 lines
846 B
C#
using NATS.Server.TestUtilities;
|
|
|
|
namespace NATS.Server.Clustering.Tests;
|
|
|
|
public class RouteHandshakeTests
|
|
{
|
|
[Fact]
|
|
public async Task Two_servers_establish_route_connection()
|
|
{
|
|
await using var a = await TestServerFactory.CreateClusterEnabledAsync();
|
|
await using var b = await TestServerFactory.CreateClusterEnabledAsync(seed: a.ClusterListen);
|
|
|
|
await a.WaitForReadyAsync();
|
|
await b.WaitForReadyAsync();
|
|
|
|
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(5));
|
|
while (!timeout.IsCancellationRequested && (a.Stats.Routes == 0 || b.Stats.Routes == 0))
|
|
{
|
|
await Task.Delay(50, timeout.Token).ContinueWith(_ => { }, TaskScheduler.Default);
|
|
}
|
|
|
|
a.Stats.Routes.ShouldBeGreaterThan(0);
|
|
b.Stats.Routes.ShouldBeGreaterThan(0);
|
|
}
|
|
}
|