test: add E2E monitoring endpoint tests (varz, connz, healthz)

Replace Task.Delay polling with PeriodicTimer in NatsServerProcess readiness
checks and extend StartAsync to also TCP-poll the monitor port when enabled,
so MonitorServerFixture is guaranteed ready before tests run.
This commit is contained in:
Joseph Doherty
2026-03-12 19:10:33 -04:00
parent 4853409a40
commit 8ad2172e3c
3 changed files with 90 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ public sealed class MonitorServerFixture : IAsyncLifetime
public async Task InitializeAsync()
{
_server = new NatsServerProcess(enableMonitoring: true);
await _server.StartAsync();
await _server.StartAsync(); // StartAsync polls both the NATS port and the monitor TCP port before returning
MonitorClient = new HttpClient { BaseAddress = new Uri($"http://127.0.0.1:{MonitorPort}") };
}