4
. "github.com/containers/podman/v5/test/utils"
5
. "github.com/onsi/ginkgo/v2"
6
. "github.com/onsi/gomega"
7
. "github.com/onsi/gomega/gexec"
10
var _ = Describe("Podman untag", func() {
12
It("podman untag all", func() {
13
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
14
tags := []string{CIRROS_IMAGE, "registry.com/foo:bar", "localhost/foo:bar"}
16
cmd := []string{"tag"}
17
cmd = append(cmd, tags...)
18
session := podmanTest.Podman(cmd)
19
session.WaitWithDefaultTimeout()
20
Expect(session).Should(ExitCleanly())
22
// Make sure that all tags exists.
23
for _, t := range tags {
24
session = podmanTest.Podman([]string{"image", "exists", t})
25
session.WaitWithDefaultTimeout()
26
Expect(session).Should(ExitCleanly())
29
// No arguments -> remove all tags.
30
session = podmanTest.Podman([]string{"untag", CIRROS_IMAGE})
31
session.WaitWithDefaultTimeout()
32
Expect(session).Should(ExitCleanly())
34
// Make sure that none of tags exists anymore.
35
for _, t := range tags {
36
session = podmanTest.Podman([]string{"image", "exists", t})
37
session.WaitWithDefaultTimeout()
38
Expect(session).Should(Exit(1))
42
It("podman tag/untag - tag normalization", func() {
43
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
46
tag, normalized string
48
{"registry.com/image:latest", "registry.com/image:latest"},
49
{"registry.com/image", "registry.com/image:latest"},
50
{"image:latest", "localhost/image:latest"},
51
{"image", "localhost/image:latest"},
54
// Make sure that the user input is normalized correctly for
55
// `podman tag` and `podman untag`.
56
for _, tt := range tests {
57
session := podmanTest.Podman([]string{"tag", CIRROS_IMAGE, tt.tag})
58
session.WaitWithDefaultTimeout()
59
Expect(session).Should(ExitCleanly())
61
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
62
session.WaitWithDefaultTimeout()
63
Expect(session).Should(ExitCleanly())
65
session = podmanTest.Podman([]string{"untag", CIRROS_IMAGE, tt.tag})
66
session.WaitWithDefaultTimeout()
67
Expect(session).Should(ExitCleanly())
69
session = podmanTest.Podman([]string{"image", "exists", tt.normalized})
70
session.WaitWithDefaultTimeout()
71
Expect(session).Should(Exit(1))