From daff2e5c7b926437a4426b9aa3a2a2444e7a7f56 Mon Sep 17 00:00:00 2001 From: Arseny Balobanov Date: Wed, 19 Feb 2020 00:26:48 +0300 Subject: [PATCH] Use %s for duration; log timeout error in test. --- tools/testtool/freeport.go | 2 +- tools/testtool/freeport_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testtool/freeport.go b/tools/testtool/freeport.go index 437e0fd..84a9fde 100644 --- a/tools/testtool/freeport.go +++ b/tools/testtool/freeport.go @@ -42,7 +42,7 @@ func WaitForPort(l logger, timeout time.Duration, port string) error { for { select { case <-stopTimer.C: - return fmt.Errorf("no server started listening on port %s after timeout %d", port, timeout) + return fmt.Errorf("no server started listening on port %s after timeout %s", port, timeout) case <-t.C: if err := portIsReady(port); err != nil { l.Logf("waiting for port: %s\n", err) diff --git a/tools/testtool/freeport_test.go b/tools/testtool/freeport_test.go index 486fb44..2189fb7 100644 --- a/tools/testtool/freeport_test.go +++ b/tools/testtool/freeport_test.go @@ -33,5 +33,7 @@ func TestWaitForPort_timeout(t *testing.T) { p, err := GetFreePort() require.NoError(t, err) - require.Error(t, WaitForPort(t, time.Second, p)) + err = WaitForPort(t, time.Second, p) + require.Error(t, err) + t.Log(err.Error()) }