Use %s for duration; log timeout error in test.

This commit is contained in:
Arseny Balobanov 2020-02-19 00:26:48 +03:00
parent b93d1be1dc
commit daff2e5c7b
2 changed files with 4 additions and 2 deletions

View file

@ -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)

View file

@ -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())
}