Return more detailed error message on timeout in WaitForPort.

This commit is contained in:
Arseny Balobanov 2020-02-19 00:11:10 +03:00
parent e1c3ec8cd0
commit b67bb030c3

View file

@ -39,7 +39,7 @@ func WaitForPort(timeout time.Duration, port string) error {
for { for {
select { select {
case <-stopTimer.C: case <-stopTimer.C:
return fmt.Errorf("timeout") return fmt.Errorf("no server started listening on port %s after timeout %d", port, timeout)
case <-t.C: case <-t.C:
if err := portIsReady(port); err != nil { if err := portIsReady(port); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "waiting for port: %s\n", err) _, _ = fmt.Fprintf(os.Stderr, "waiting for port: %s\n", err)