From bb1c462b36914362c2e11b3773593e8e25f27c38 Mon Sep 17 00:00:00 2001 From: Gianluca Arbezzano Date: Wed, 5 Feb 2020 09:57:01 +0100 Subject: [PATCH] Fix panic in wait host port When DialWithContext fails we were not checking for error. Fixed #139 Signed-off-by: Gianluca Arbezzano --- wait/host_port.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wait/host_port.go b/wait/host_port.go index 3f61e4fbd3..abaa954663 100644 --- a/wait/host_port.go +++ b/wait/host_port.go @@ -3,13 +3,14 @@ package wait import ( "context" "fmt" - "github.com/pkg/errors" "net" "os" "strconv" "syscall" "time" + "github.com/pkg/errors" + "github.com/docker/go-connections/nat" ) @@ -70,6 +71,9 @@ func (hp *HostPortStrategy) WaitUntilReady(ctx context.Context, target StrategyT address := net.JoinHostPort(ipAddress, portString) for { conn, err := dialer.DialContext(ctx, proto, address) + if err != nil { + return err + } defer conn.Close() if err != nil { if v, ok := err.(*net.OpError); ok {