summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-01-09 10:28:21 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-01-10 16:13:33 -0500
commit19a475906612b603b11fbbf6ee6a6978a4bd9586 (patch)
tree6ae0507c33be21bcc265a547322f94fc4a00db7f /test
parent87cd4b698cea28ef99b3b3326309b068b9aa7f04 (diff)
downloadpodman-19a475906612b603b11fbbf6ee6a6978a4bd9586.tar.gz
podman-19a475906612b603b11fbbf6ee6a6978a4bd9586.tar.bz2
podman-19a475906612b603b11fbbf6ee6a6978a4bd9586.zip
Use the InfraImage defined in containers.conf
Remove hard code use of the DefaultInfraImage and rely on getting this from containers.conf. Fixes: https://github.com/containers/podman/issues/12771 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/containers_conf_test.go32
-rw-r--r--test/system/200-pod.bats5
2 files changed, 36 insertions, 1 deletions
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 2a6f177f2..838221dd5 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -452,4 +452,36 @@ var _ = Describe("Podman run", func() {
Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("(default 1234)"))
})
+
+ It("podman bad infra_image name in containers.conf", func() {
+ infra1 := "i.do/not/exist:image"
+ infra2 := "i.still.do/not/exist:image"
+ errorString := "initializing source docker://" + infra1
+ error2String := "initializing source docker://" + infra2
+ configPath := filepath.Join(podmanTest.TempDir, "containers.conf")
+ os.Setenv("CONTAINERS_CONF", configPath)
+
+ containersConf := []byte("[engine]\ninfra_image=\"" + infra1 + "\"")
+ err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
+ Expect(err).To(BeNil())
+
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
+ result := podmanTest.Podman([]string{"pod", "create", "--infra-image", infra2})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(125))
+ Expect(result.ErrorToString()).To(ContainSubstring(error2String))
+
+ result = podmanTest.Podman([]string{"pod", "create"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(125))
+ Expect(result.ErrorToString()).To(ContainSubstring(errorString))
+
+ result = podmanTest.Podman([]string{"create", "--pod", "new:pod1", ALPINE})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(125))
+ Expect(result.ErrorToString()).To(ContainSubstring(errorString))
+ })
})
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 57d052ce2..6abdf9779 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -62,8 +62,8 @@ function teardown() {
@test "podman pod create - custom infra image" {
+ skip_if_remote "CONTAINERS_CONF only effects server side"
image="i.do/not/exist:image"
-
tmpdir=$PODMAN_TMPDIR/pod-test
run mkdir -p $tmpdir
containersconf=$tmpdir/containers.conf
@@ -77,6 +77,9 @@ EOF
CONTAINERS_CONF=$containersconf run_podman 125 pod create
is "$output" ".*initializing source docker://$image:.*"
+
+ CONTAINERS_CONF=$containersconf run_podman 125 create --pod new:test $IMAGE
+ is "$output" ".*initializing source docker://$image:.*"
}
@test "podman pod - communicating between pods" {