diff options
author | baude <bbaude@redhat.com> | 2018-03-21 13:08:32 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-22 19:06:51 +0000 |
commit | d364d41e1b1cf42d11b383fb02fbaa07e8b156f7 (patch) | |
tree | ced7036c6dbb7e6a6659f79153618b910009386e /test/e2e/rmi_test.go | |
parent | 2cc51dbb1c0eff1d193e41a8d7e898830c186791 (diff) | |
download | podman-d364d41e1b1cf42d11b383fb02fbaa07e8b156f7.tar.gz podman-d364d41e1b1cf42d11b383fb02fbaa07e8b156f7.tar.bz2 podman-d364d41e1b1cf42d11b383fb02fbaa07e8b156f7.zip |
Removing tagged images change in behavior
An image name is really just a tag. When an image has multiple tags, we should be
able to "delete" the one of its tags without harm. In this case, the "delete' is
really a form of Untag (removing the tag from the image).
If an image has multiple tags and the user tries to delete by ID without force, this
should be denied because when you delete by ID there is no distinguishing it like
image tags.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #528
Approved by: mheon
Diffstat (limited to 'test/e2e/rmi_test.go')
-rw-r--r-- | test/e2e/rmi_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 04346f5ac..67ccc1b95 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -67,4 +67,40 @@ var _ = Describe("Podman rmi", func() { }) + It("podman rmi tagged image", func() { + setup := podmanTest.Podman([]string{"images", "-q", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"tag", "alpine", "foo:bar", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"images", "-q", "foo"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + + Expect(result.LineInOuputContains(setup.OutputToString())).To(BeTrue()) + }) + + It("podman rmi image with tags by ID cannot be done without force", func() { + setup := podmanTest.Podman([]string{"images", "-q", ALPINE}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + alpineId := setup.OutputToString() + + session := podmanTest.Podman([]string{"tag", "alpine", "foo:bar", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + // Trying without --force should fail + result := podmanTest.Podman([]string{"rmi", alpineId}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).ToNot(Equal(0)) + + // With --force it should work + resultForce := podmanTest.Podman([]string{"rmi", "-f", alpineId}) + resultForce.WaitWithDefaultTimeout() + Expect(resultForce.ExitCode()).To(Equal(0)) + }) }) |