summaryrefslogtreecommitdiff
path: root/test/e2e/common_test.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2021-02-15 09:32:49 -0600
committerbaude <bbaude@redhat.com>2021-02-16 06:29:49 -0600
commitf2f18768a8c705a0a15abe814aaa52640af0b279 (patch)
treed75c9f94d5789999e1227438ae1df4fecfe147c7 /test/e2e/common_test.go
parent8c444e6f0b3663a657c946e1c731f390553f065d (diff)
downloadpodman-f2f18768a8c705a0a15abe814aaa52640af0b279.tar.gz
podman-f2f18768a8c705a0a15abe814aaa52640af0b279.tar.bz2
podman-f2f18768a8c705a0a15abe814aaa52640af0b279.zip
Fix panic in pod creation
when creating a pod with --infra-image and using a untagged image for the infra-image (none/none), the lookup for the image's name was creating a panic. Fixes: #9374 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e/common_test.go')
-rw-r--r--test/e2e/common_test.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index d033cc646..12b30b2c5 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -436,13 +436,20 @@ func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSe
// BuildImage uses podman build and buildah to build an image
// called imageName based on a string dockerfile
-func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) {
+func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) string {
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
Expect(err).To(BeNil())
- session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir})
+ cmd := []string{"build", "--layers=" + layers, "--file", dockerfilePath}
+ if len(imageName) > 0 {
+ cmd = append(cmd, []string{"-t", imageName}...)
+ }
+ cmd = append(cmd, p.TempDir)
+ session := p.Podman(cmd)
session.Wait(240)
Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString()))
+ output := session.OutputToStringArray()
+ return output[len(output)-1]
}
// PodmanPID execs podman and returns its PID