summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-28 14:36:43 +0000
committerGitHub <noreply@github.com>2020-09-28 14:36:43 +0000
commitd2802636b0a7e3d281e52b44676de5e3226fbabf (patch)
tree0bff853639fdce694a15879793b4ea89caa993b5 /test
parent97841e55072ae71713922ab6c6c1269e74b08dcf (diff)
parent1b5853e64794403d80c4d339c97b61dd63dd093a (diff)
downloadpodman-d2802636b0a7e3d281e52b44676de5e3226fbabf.tar.gz
podman-d2802636b0a7e3d281e52b44676de5e3226fbabf.tar.bz2
podman-d2802636b0a7e3d281e52b44676de5e3226fbabf.zip
Merge pull request #7770 from rhatdan/pullpolicy
Properly handle podman run --pull command
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_apparmor_test.go2
-rw-r--r--test/e2e/run_test.go42
2 files changed, 43 insertions, 1 deletions
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 7d522a752..0faf0b496 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -106,7 +106,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
Expect(parse.ExitCode()).To(Equal(0))
- session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", "ls"})
+ session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=aa-test-profile", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 0bb3fe772..5c28f18f2 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1273,4 +1273,46 @@ WORKDIR /madethis`
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman run a container with --pull never should fail if no local store", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "never", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
+
+ It("podman run container with --pull missing and only pull once", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "missing", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
+ })
+
+ It("podman run container with --pull missing should pull image multiple times", func() {
+ // Make sure ALPINE image does not exist. Ignore errors
+ session := podmanTest.PodmanNoCache([]string{"rmi", "--force", "never", ALPINE})
+ session.WaitWithDefaultTimeout()
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+
+ session = podmanTest.PodmanNoCache([]string{"run", "--pull", "always", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
+ })
})