diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-13 12:46:20 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-13 12:46:20 +0200 |
| commit | 07d654f76e1002b6ac18a43aab3c64797dcd2a32 (patch) | |
| tree | fe7774fe0f97a5f8d8b38970bf31354048a8afd0 /integrationtests/dtailhealth_test.go | |
| parent | 74ece728fe61fb74e020a87dde2c84f5f7e933ea (diff) | |
Harden integration server startup checks
Diffstat (limited to 'integrationtests/dtailhealth_test.go')
| -rw-r--r-- | integrationtests/dtailhealth_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
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) |
