summaryrefslogtreecommitdiff
path: root/test/e2e/push_test.go
diff options
context:
space:
mode:
authorYiqiao Pu <ypu@redhat.com>2018-04-10 18:48:22 +0800
committerYiqiao Pu <ypu@redhat.com>2018-04-16 10:55:21 +0800
commitd6d7edb841a8c3044c81386fdb4113dd895a26f3 (patch)
tree80d26947ffdd018f03148956a3210a9ed89a4ca2 /test/e2e/push_test.go
parent0fe0c79dc9f7074e30466c81e0fbc157faa00db2 (diff)
downloadpodman-d6d7edb841a8c3044c81386fdb4113dd895a26f3.tar.gz
podman-d6d7edb841a8c3044c81386fdb4113dd895a26f3.tar.bz2
podman-d6d7edb841a8c3044c81386fdb4113dd895a26f3.zip
Add WaitContainerReady for wait for docker registry ready
Sometime podman push local registry still failed caused by the docker registry is not start yet after sleep 5s in the test. So add this function to check the container status by its output and skip the test when the docker registry can not start normally instead of failed the case. Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Diffstat (limited to 'test/e2e/push_test.go')
-rw-r--r--test/e2e/push_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 8593c3e99..f5bfc0c53 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -4,7 +4,6 @@ import (
"os"
"path/filepath"
"strings"
- "time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -56,12 +55,13 @@ var _ = Describe("Podman push", func() {
})
It("podman push to local registry", func() {
- session := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", "docker.io/library/registry:2", "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- // Give the registry 5 seconds to warm up before pushing
- time.Sleep(5 * time.Second)
+ if !WaitContainerReady(&podmanTest, "registry", "listening on", 20, 1) {
+ Skip("Can not start docker registry.")
+ }
push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push.WaitWithDefaultTimeout()
@@ -108,7 +108,9 @@ var _ = Describe("Podman push", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- time.Sleep(5 * time.Second)
+ if !WaitContainerReady(&podmanTest, "registry", "listening on", 20, 1) {
+ Skip("Can not start docker registry.")
+ }
session = podmanTest.Podman([]string{"logs", "registry"})
session.WaitWithDefaultTimeout()