summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/e2e/common_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 261db8a9a..e882b6be3 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -1081,15 +1081,17 @@ func WaitForFile(path string) (err error) {
// WaitForService blocks, waiting for some service listening on given host:port
func WaitForService(address url.URL) {
// Wait for podman to be ready
- var conn net.Conn
var err error
for i := 1; i <= 5; i++ {
+ var conn net.Conn
conn, err = net.Dial("tcp", address.Host)
- if err != nil {
- // Podman not available yet...
- time.Sleep(time.Duration(i) * time.Second)
+ if err == nil {
+ conn.Close()
+ break
}
+
+ // Podman not available yet...
+ time.Sleep(time.Duration(i) * time.Second)
}
Expect(err).ShouldNot(HaveOccurred())
- conn.Close()
}