test: add E2E gateway tests (cross-gateway messaging, interest-only)

- GatewayFixture: polls /gatewayz monitoring endpoint until both servers
  report num_gateways >= 1, replacing Task.Delay with proper synchronization
- GatewayTests: two tests covering cross-gateway delivery and interest-only
  no-delivery behaviour, using double PingAsync() instead of Task.Delay
- LeafNodeTests: replace Task.Delay(500) with sub.PingAsync()+pub.PingAsync()
  to properly fence subscription propagation without timing dependencies
- Fix GatewayManager.StartAsync to read remotes from RemoteGateways (config-
  parsed) in addition to the legacy Remotes list, enabling config-file-driven
  outbound gateway connections
This commit is contained in:
Joseph Doherty
2026-03-12 19:45:54 -04:00
parent 5d9d1bebd5
commit 338f44b07b
4 changed files with 243 additions and 1 deletions

View File

@@ -210,7 +210,17 @@ public sealed class GatewayManager : IAsyncDisposable
_options.Port = ((IPEndPoint)_listener.LocalEndPoint!).Port;
_acceptLoopTask = Task.Run(() => AcceptLoopAsync(_cts.Token));
foreach (var remote in _options.Remotes.Distinct(StringComparer.OrdinalIgnoreCase))
// Collect outbound endpoints from both the legacy Remotes list and the
// config-parsed RemoteGateways list (populated by ConfigProcessor).
var endpoints = new HashSet<string>(_options.Remotes, StringComparer.OrdinalIgnoreCase);
foreach (var rgw in _options.RemoteGateways)
{
foreach (var uri in rgw.GetUrls())
endpoints.Add($"{uri.Host}:{uri.Port}");
}
foreach (var remote in endpoints)
_ = Task.Run(() => ConnectWithRetryAsync(remote, _cts.Token));
_logger.LogDebug("Gateway manager started (name={Name}, listen={Host}:{Port})",