fix: address MonitorServer review — dispose resources, add cancellation, improve test reliability

This commit is contained in:
Joseph Doherty
2026-02-22 22:30:14 -05:00
parent 63198ef83b
commit 818bc0ba1f
3 changed files with 27 additions and 10 deletions

View File

@@ -27,8 +27,17 @@ public class MonitorTests : IAsyncLifetime
{
_ = _server.StartAsync(_cts.Token);
await _server.WaitForReadyAsync();
// Give monitoring server time to start
await Task.Delay(200);
// Wait for monitoring HTTP server to be ready
for (int i = 0; i < 50; i++)
{
try
{
var response = await _http.GetAsync($"http://127.0.0.1:{_monitorPort}/healthz");
if (response.IsSuccessStatusCode) break;
}
catch (HttpRequestException) { }
await Task.Delay(50);
}
}
public async Task DisposeAsync()