summaryrefslogtreecommitdiff
path: root/test/e2e/common_test.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-05 14:25:58 +0000
committerGitHub <noreply@github.com>2022-07-05 14:25:58 +0000
commit9539a89ee77682ed3f4d1d0be3b950523e2f2439 (patch)
tree9d26db63cd83fd0b18266f314cb63b9ca6a5787d /test/e2e/common_test.go
parent74466d14fff53f375e8106849c6254a34f47e576 (diff)
parent2da731a7eac469f857879d5cda5c3cfa45e84f92 (diff)
downloadpodman-9539a89ee77682ed3f4d1d0be3b950523e2f2439.tar.gz
podman-9539a89ee77682ed3f4d1d0be3b950523e2f2439.tar.bz2
podman-9539a89ee77682ed3f4d1d0be3b950523e2f2439.zip
Merge pull request #14831 from giuseppe/fix-leak-connections-test
two minor tweaks to common_test.go
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r--test/e2e/common_test.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 2fc967718..559f8ffd7 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -1061,13 +1061,13 @@ func digShort(container, lookupName, expectedIP string, p *PodmanTestIntegration
// WaitForFile to be created in defaultWaitTimeout seconds, returns false if file not created
func WaitForFile(path string) (err error) {
until := time.Now().Add(time.Duration(defaultWaitTimeout) * time.Second)
- for i := 1; time.Now().Before(until); i++ {
+ for time.Now().Before(until) {
_, err = os.Stat(path)
switch {
case err == nil:
return nil
case errors.Is(err, os.ErrNotExist):
- time.Sleep(time.Duration(i) * time.Second)
+ time.Sleep(10 * time.Millisecond)
default:
return err
}
@@ -1075,18 +1075,21 @@ func WaitForFile(path string) (err error) {
return err
}
-// WaitForService blocks, waiting for some service listening on given host:port
+// WaitForService blocks for defaultWaitTimeout seconds, 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++ {
+ until := time.Now().Add(time.Duration(defaultWaitTimeout) * time.Second)
+ for time.Now().Before(until) {
+ 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(10 * time.Millisecond)
}
Expect(err).ShouldNot(HaveOccurred())
- conn.Close()
}