summaryrefslogtreecommitdiff
path: root/test/e2e/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r--test/e2e/common_test.go33
1 files changed, 18 insertions, 15 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 2fc967718..43367cf63 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -36,10 +36,10 @@ import (
var (
//lint:ignore ST1003
- PODMAN_BINARY string //nolint:revive,stylecheck
- INTEGRATION_ROOT string //nolint:revive,stylecheck
- CGROUP_MANAGER = "systemd" //nolint:revive,stylecheck
- RESTORE_IMAGES = []string{ALPINE, BB, nginx} //nolint:revive,stylecheck
+ PODMAN_BINARY string //nolint:revive,stylecheck
+ INTEGRATION_ROOT string //nolint:revive,stylecheck
+ CGROUP_MANAGER = "systemd" //nolint:revive,stylecheck
+ RESTORE_IMAGES = []string{ALPINE, BB, NGINX_IMAGE} //nolint:revive,stylecheck
defaultWaitTimeout = 90
CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode()
)
@@ -115,7 +115,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
podman := PodmanTestSetup("/tmp")
// Pull cirros but don't put it into the cache
- pullImages := []string{cirros, fedoraToolbox, volumeTest}
+ pullImages := []string{CIRROS_IMAGE, fedoraToolbox, volumeTest}
pullImages = append(pullImages, CACHE_IMAGES...)
for _, image := range pullImages {
podman.createArtifact(image)
@@ -464,7 +464,7 @@ func (p *PodmanTestIntegration) RunNginxWithHealthCheck(name string) (*PodmanSes
podmanArgs = append(podmanArgs, "--name", name)
}
// curl without -f exits 0 even if http code >= 400!
- podmanArgs = append(podmanArgs, "-dt", "-P", "--health-cmd", "curl -f http://localhost/", nginx)
+ podmanArgs = append(podmanArgs, "-dt", "-P", "--health-cmd", "curl -f http://localhost/", NGINX_IMAGE)
session := p.Podman(podmanArgs)
session.WaitWithDefaultTimeout()
return session, session.OutputToString()
@@ -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()
}