aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/create_test.go13
-rw-r--r--test/e2e/untag_test.go76
-rw-r--r--test/system/020-tag.bats35
3 files changed, 97 insertions, 27 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 52ce0b46a..44bb5c45f 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -458,4 +458,17 @@ var _ = Describe("Podman create", func() {
Expect(session.ExitCode()).To(Equal(0))
}
})
+
+ It("podman create sets default stop signal 15", func() {
+ ctrName := "testCtr"
+ session := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectContainerToJSON()
+ Expect(len(data)).To(Equal(1))
+ Expect(data[0].Config.StopSignal).To(Equal(uint(15)))
+ })
})
diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go
index dc1a6208e..8a1c8091d 100644
--- a/test/e2e/untag_test.go
+++ b/test/e2e/untag_test.go
@@ -23,13 +23,6 @@ var _ = Describe("Podman untag", func() {
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
-
- for _, tag := range []string{"test", "foo", "bar"} {
- session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, tag})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- }
-
})
AfterEach(func() {
@@ -40,34 +33,63 @@ var _ = Describe("Podman untag", func() {
})
It("podman untag all", func() {
- session := podmanTest.PodmanNoCache([]string{"untag", ALPINE})
+ tags := []string{ALPINE, "registry.com/foo:bar", "localhost/foo:bar"}
+
+ cmd := []string{"tag"}
+ cmd = append(cmd, tags...)
+ session := podmanTest.PodmanNoCache(cmd)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- results := podmanTest.PodmanNoCache([]string{"images", ALPINE})
- results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
- Expect(results.OutputToStringArray()).To(HaveLen(1))
- })
+ // Make sure that all tags exists.
+ for _, t := range tags {
+ session = podmanTest.PodmanNoCache([]string{"image", "exists", t})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ }
- It("podman untag single", func() {
- session := podmanTest.PodmanNoCache([]string{"untag", ALPINE, "localhost/test:latest"})
+ // No arguments -> remove all tags.
+ session = podmanTest.PodmanNoCache([]string{"untag", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- results := podmanTest.PodmanNoCache([]string{"images"})
- results.WaitWithDefaultTimeout()
- Expect(results.ExitCode()).To(Equal(0))
- Expect(results.OutputToStringArray()).To(HaveLen(6))
- Expect(results.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue())
- Expect(results.LineInOuputStartsWith("localhost/foo")).To(BeTrue())
- Expect(results.LineInOuputStartsWith("localhost/bar")).To(BeTrue())
- Expect(results.LineInOuputStartsWith("localhost/test")).To(BeFalse())
+ // Make sure that none of tags exists anymore.
+ for _, t := range tags {
+ session = podmanTest.PodmanNoCache([]string{"image", "exists", t})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+ }
})
- It("podman untag not enough arguments", func() {
- session := podmanTest.PodmanNoCache([]string{"untag"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).NotTo(Equal(0))
+ It("podman tag/untag - tag normalization", func() {
+ tests := []struct {
+ tag, normalized string
+ }{
+ {"registry.com/image:latest", "registry.com/image:latest"},
+ {"registry.com/image", "registry.com/image:latest"},
+ {"image:latest", "localhost/image:latest"},
+ {"image", "localhost/image:latest"},
+ }
+
+ // Make sure that the user input is normalized correctly for
+ // `podman tag` and `podman untag`.
+ for _, tt := range tests {
+ session := podmanTest.PodmanNoCache([]string{"tag", ALPINE, tt.tag})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.PodmanNoCache([]string{"image", "exists", tt.normalized})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.PodmanNoCache([]string{"untag", ALPINE, tt.tag})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.PodmanNoCache([]string{"image", "exists", tt.normalized})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+ }
})
+
})
diff --git a/test/system/020-tag.bats b/test/system/020-tag.bats
new file mode 100644
index 000000000..7593ad68f
--- /dev/null
+++ b/test/system/020-tag.bats
@@ -0,0 +1,35 @@
+#!/usr/bin/env bats
+
+load helpers
+
+# helper function for "podman tag/untag" test
+function _tag_and_check() {
+ local tag_as="$1"
+ local check_as="$2"
+
+ run_podman tag $IMAGE $tag_as
+ run_podman image exists $check_as
+ run_podman untag $IMAGE $check_as
+ run_podman 1 image exists $check_as
+}
+
+@test "podman tag/untag" {
+ # Test a fully-qualified image reference.
+ _tag_and_check registry.com/image:latest registry.com/image:latest
+
+ # Test a reference without tag and make sure ":latest" is appended.
+ _tag_and_check registry.com/image registry.com/image:latest
+
+ # Test a tagged short image and make sure "localhost/" is prepended.
+ _tag_and_check image:latest localhost/image:latest
+
+ # Test a short image without tag and make sure "localhost/" is
+ # prepended and ":latest" is appended.
+ _tag_and_check image localhost/image:latest
+
+ # Test error case.
+ run_podman 125 untag $IMAGE registry.com/foo:bar
+ is "$output" "Error: \"registry.com/foo:bar\": no such tag"
+}
+
+# vim: filetype=sh