Use %s for duration; log timeout error in test.
This commit is contained in:
parent
b93d1be1dc
commit
daff2e5c7b
2 changed files with 4 additions and 2 deletions
|
@ -42,7 +42,7 @@ func WaitForPort(l logger, timeout time.Duration, port string) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stopTimer.C:
|
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:
|
case <-t.C:
|
||||||
if err := portIsReady(port); err != nil {
|
if err := portIsReady(port); err != nil {
|
||||||
l.Logf("waiting for port: %s\n", err)
|
l.Logf("waiting for port: %s\n", err)
|
||||||
|
|
|
@ -33,5 +33,7 @@ func TestWaitForPort_timeout(t *testing.T) {
|
||||||
p, err := GetFreePort()
|
p, err := GetFreePort()
|
||||||
require.NoError(t, err)
|
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())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue