summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2022-04-04 13:04:40 -0700
committerJhon Honce <jhonce@redhat.com>2022-05-03 13:49:01 -0700
commit8da5f3f733273245dd4e86324ca88bf8e4ede37a (patch)
tree2c87e85d53cf01763fec61464e5a208b18de83ae /test/e2e
parent1e0c50df38ff955011f7ebb83a0268f3f1cd2841 (diff)
downloadpodman-8da5f3f733273245dd4e86324ca88bf8e4ede37a.tar.gz
podman-8da5f3f733273245dd4e86324ca88bf8e4ede37a.tar.bz2
podman-8da5f3f733273245dd4e86324ca88bf8e4ede37a.zip
Add podman machine events
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/common_test.go34
-rw-r--r--test/e2e/system_service_test.go16
2 files changed, 34 insertions, 16 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index a61ef8640..28991af7f 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"math/rand"
"net"
+ "net/url"
"os"
"os/exec"
"path/filepath"
@@ -1063,3 +1064,36 @@ func digShort(container, lookupName string, matchNames []string, p *PodmanTestIn
}
Fail("dns is not responding")
}
+
+// 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++ {
+ _, err = os.Stat(path)
+ switch {
+ case err == nil:
+ return nil
+ case errors.Is(err, os.ErrNotExist):
+ time.Sleep(time.Duration(i) * time.Second)
+ default:
+ return err
+ }
+ }
+ return err
+}
+
+// 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++ {
+ conn, err = net.Dial("tcp", address.Host)
+ if err != nil {
+ // Podman not available yet...
+ time.Sleep(time.Duration(i) * time.Second)
+ }
+ }
+ Expect(err).ShouldNot(HaveOccurred())
+ conn.Close()
+}
diff --git a/test/e2e/system_service_test.go b/test/e2e/system_service_test.go
index 2bc7756d6..4c16ea788 100644
--- a/test/e2e/system_service_test.go
+++ b/test/e2e/system_service_test.go
@@ -122,22 +122,6 @@ var _ = Describe("podman system service", func() {
})
})
-// 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++ {
- conn, err = net.Dial("tcp", address.Host)
- if err != nil {
- // Podman not available yet...
- time.Sleep(time.Duration(i) * time.Second)
- }
- }
- Expect(err).ShouldNot(HaveOccurred())
- conn.Close()
-}
-
// randomPort leans on the go net library to find an available port...
func randomPort() string {
port, err := utils.GetRandomPort()