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.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// Copyright 2020-2025 The NATS Authors
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
|
||||
namespace ZB.MOM.NatsNet.Server.IntegrationTests.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Polling / assertion helpers ported from the Go test framework's checkFor and
|
||||
/// related utilities.
|
||||
/// </summary>
|
||||
public static class CheckHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Polls <paramref name="check"/> every <paramref name="interval"/> until it
|
||||
/// returns null (success) or <paramref name="timeout"/> expires.
|
||||
/// </summary>
|
||||
public static void CheckFor(
|
||||
TimeSpan timeout,
|
||||
TimeSpan interval,
|
||||
Func<string?> check)
|
||||
{
|
||||
var deadline = DateTime.UtcNow + timeout;
|
||||
string? last = null;
|
||||
while (DateTime.UtcNow < deadline)
|
||||
{
|
||||
last = check();
|
||||
if (last is null)
|
||||
return;
|
||||
Thread.Sleep(interval);
|
||||
}
|
||||
throw new Xunit.Sdk.XunitException($"CheckFor timed out after {timeout}: {last}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits until the supplied server reports exactly <paramref name="expected"/>
|
||||
/// leaf-node connections.
|
||||
/// </summary>
|
||||
public static void CheckLeafNodeConnectedCount(object server, int expected) =>
|
||||
throw new NotImplementedException("Requires a running server instance.");
|
||||
}
|
||||
Reference in New Issue
Block a user