From 07d654f76e1002b6ac18a43aab3c64797dcd2a32 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 13 Mar 2026 12:46:20 +0200 Subject: Harden integration server startup checks --- integrationtests/dtailhealth_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'integrationtests/dtailhealth_test.go') diff --git a/integrationtests/dtailhealth_test.go b/integrationtests/dtailhealth_test.go index 74773f2..89e2996 100644 --- a/integrationtests/dtailhealth_test.go +++ b/integrationtests/dtailhealth_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "testing" - "time" "github.com/mimecast/dtail/internal/config" ) @@ -73,8 +72,10 @@ func testDTailHealth1WithServer(t *testing.T, logger *TestLogger) { return } - // Give server time to start - time.Sleep(500 * time.Millisecond) + if err := waitForServerReady(ctx, bindAddress, port); err != nil { + t.Error(err) + return + } t.Log("Server mode check without --server flag, is supposed to exit with warning state.") // Run dtailhealth without specifying --server flag @@ -157,8 +158,10 @@ func testDTailHealth2WithServer(t *testing.T, logger *TestLogger) { return } - // Give server time to start - time.Sleep(500 * time.Millisecond) + if err := waitForServerReady(ctx, bindAddress, port); err != nil { + t.Error(err) + return + } t.Log("Server mode negative test, checking unreachable server, is supposed to exit with a critical state.") // Check an unreachable server (not the one we started) -- cgit v1.2.3