diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-09-15 15:36:00 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-09-22 15:45:41 -0400 |
commit | d27fcbdc21a4c5fc201997068f871cf1e91561a1 (patch) | |
tree | 437f0ed508d38ba325662d378510a966b71c0d81 /test | |
parent | 1a25a90a4ec01fb254b617a8350683cbf28c6ca5 (diff) | |
download | podman-d27fcbdc21a4c5fc201997068f871cf1e91561a1.tar.gz podman-d27fcbdc21a4c5fc201997068f871cf1e91561a1.tar.bz2 podman-d27fcbdc21a4c5fc201997068f871cf1e91561a1.zip |
container runlabel remove image tag from name
When no name is given for podman container runlabel it will default to
the image base name. However this can contain a tag. Since podman does
not accept container names with a colon the run command will fail if it
contains something like `podman run --name NAME ...`.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2004263
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/runlabel_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go index e67b6cba1..656eaaceb 100644 --- a/test/e2e/runlabel_test.go +++ b/test/e2e/runlabel_test.go @@ -22,6 +22,10 @@ var GlobalDockerfile = fmt.Sprintf(` FROM %s LABEL RUN echo \$GLOBAL_OPTS`, ALPINE) +var PodmanRunlabelNameDockerfile = fmt.Sprintf(` +FROM %s +LABEL RUN podman run --name NAME IMAGE`, ALPINE) + var _ = Describe("podman container runlabel", func() { var ( tempdir string @@ -128,4 +132,18 @@ var _ = Describe("podman container runlabel", func() { result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) }) + + It("podman container runlabel name removes tag from image", func() { + image := "podman-runlabel-name:sometag" + podmanTest.BuildImage(PodmanRunlabelNameDockerfile, image, "false") + + result := podmanTest.Podman([]string{"container", "runlabel", "--display", "RUN", image}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(result.OutputToString()).To(Equal("command: " + podmanTest.PodmanBinary + " run --name podman-runlabel-name localhost/" + image)) + + result = podmanTest.Podman([]string{"rmi", image}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + }) }) |