summaryrefslogtreecommitdiff
path: root/integrationtests/dtailhealth_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-24 14:06:11 +0300
committerPaul Buetow <paul@buetow.org>2021-10-24 14:06:11 +0300
commit6cfc4e161f94ab159d4b1ea491ffe6f166fa6204 (patch)
tree093fb4bff0bdf086188df86ca5d13dc7f8a34e4f /integrationtests/dtailhealth_test.go
parent87b6c47999f49c2deff42fdcc703c419b251bdbc (diff)
Integration tests can run concurrently, so we now have unique TCP ports for each
Diffstat (limited to 'integrationtests/dtailhealth_test.go')
-rw-r--r--integrationtests/dtailhealth_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/integrationtests/dtailhealth_test.go b/integrationtests/dtailhealth_test.go
index 0dc177c..271f11d 100644
--- a/integrationtests/dtailhealth_test.go
+++ b/integrationtests/dtailhealth_test.go
@@ -62,7 +62,9 @@ func TestDTailHealthCheck3(t *testing.T) {
return
}
stdoutFile := "dtailhealth3.stdout.tmp"
- expectedStdoutFile := "dtailhealth3.expected"
+ port := getUniquePortNumber()
+ bindAddress := "localhost"
+ expectedOut := fmt.Sprintf("OK: All fine at %s:%d :-)", bindAddress, port)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -72,23 +74,22 @@ func TestDTailHealthCheck3(t *testing.T) {
"--cfg", "none",
"--logger", "stdout",
"--logLevel", "trace",
- "--bindAddress", "localhost",
- "--port", "4242",
+ "--bindAddress", bindAddress,
+ "--port", fmt.Sprintf("%d", port),
)
if err != nil {
t.Error(err)
return
}
- // TODO: Get unique test port number.
_, err = runCommandRetry(ctx, t, 10, stdoutFile,
- "../dtailhealth", "--server", "localhost:4242")
+ "../dtailhealth", "--server", fmt.Sprintf("%s:%d", bindAddress, port))
if err != nil {
t.Error(err)
return
}
- if err := compareFiles(t, stdoutFile, expectedStdoutFile); err != nil {
+ if err := fileContainsStr(t, stdoutFile, expectedOut); err != nil {
t.Error(err)
return
}