Files
natsnet/dotnet/tests/ZB.MOM.NatsNet.Server.IntegrationTests/Helpers/TestSuperCluster.cs
Joseph Doherty bebff9168a test(batch57): port 53 SuperCluster and LeafNode integration tests
Ports 36 JetStream super-cluster tests from jetstream_super_cluster_test.go,
3 JetStream leaf-node tests from jetstream_leafnode_test.go, and 14 leaf-node
tests from leafnode_test.go into the integration test project. Creates the
required harness infrastructure (TestSuperCluster, TestCluster, IntegrationTestBase,
CheckHelper, ConfigHelper, NatsTestClient, TestServerHelper). All 53 tests are
marked [Fact(Skip = "...")] pending full multi-server cluster runtime.
2026-03-01 12:15:44 -05:00

50 lines
1.7 KiB
C#

// Copyright 2020-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0
namespace ZB.MOM.NatsNet.Server.IntegrationTests.Helpers;
/// <summary>
/// Placeholder harness for a JetStream super-cluster (multiple clusters connected
/// by gateways). The real implementation requires the full NatsServer runtime to
/// be capable of spawning in-process cluster nodes.
/// </summary>
public sealed class TestSuperCluster : IDisposable
{
private readonly List<TestCluster> _clusters;
private TestSuperCluster(List<TestCluster> clusters)
{
_clusters = clusters;
}
/// <summary>
/// Creates a super-cluster with <paramref name="numClusters"/> clusters, each
/// containing <paramref name="numPerCluster"/> servers.
/// Not yet implemented — tests that call this will be skipped.
/// </summary>
public static TestSuperCluster CreateJetStreamSuperCluster(int numPerCluster, int numClusters) =>
new([]);
/// <summary>Returns the current JetStream meta-leader across all clusters.</summary>
public object? Leader() => null;
/// <summary>Returns a random server from any cluster in the super-cluster.</summary>
public object? RandomServer() => null;
/// <summary>Waits until a meta-leader is elected.</summary>
public void WaitOnLeader() { /* placeholder */ }
/// <summary>Waits until a stream leader is elected in the given account.</summary>
public void WaitOnStreamLeader(string account, string stream) { /* placeholder */ }
/// <summary>Returns the named cluster.</summary>
public TestCluster ClusterForName(string name) =>
_clusters.Single(c => c.Name == name);
public void Dispose()
{
foreach (var c in _clusters)
c.Dispose();
}
}