aboutsummaryrefslogtreecommitdiff
path: root/test/e2e/manifest_test.go
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2020-04-23 15:36:47 -0400
committerQi Wang <qiwan@redhat.com>2020-05-06 10:54:28 -0400
commit5621f5199d0aeaefae77db920866d7aeea9d1e7b (patch)
tree93ade2da60914f8de8d0745b0ef7da9a154f1db1 /test/e2e/manifest_test.go
parent0eb905ff2c2f033ee3009d8d374dcd2347ac04d1 (diff)
downloadpodman-5621f5199d0aeaefae77db920866d7aeea9d1e7b.tar.gz
podman-5621f5199d0aeaefae77db920866d7aeea9d1e7b.tar.bz2
podman-5621f5199d0aeaefae77db920866d7aeea9d1e7b.zip
Manifest remove, push
Implements podman manifest remove and podman manifest push. Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'test/e2e/manifest_test.go')
-rw-r--r--test/e2e/manifest_test.go88
1 files changed, 88 insertions, 0 deletions
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index be6919bdc..f622bf042 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -2,6 +2,8 @@ package integration
import (
"os"
+ "path/filepath"
+ "strings"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -114,4 +116,90 @@ var _ = Describe("Podman manifest", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`))
})
+
+ It("podman manifest remove", func() {
+ session := podmanTest.Podman([]string{"manifest", "create", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
+ session = podmanTest.Podman([]string{"manifest", "remove", "foo", imageListARM64InstanceDigest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(imageListAMD64InstanceDigest))
+ Expect(session.OutputToString()).To(ContainSubstring(imageListARMInstanceDigest))
+ Expect(session.OutputToString()).To(ContainSubstring(imageListPPC64LEInstanceDigest))
+ Expect(session.OutputToString()).To(ContainSubstring(imageListS390XInstanceDigest))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(imageListARM64InstanceDigest)))
+ })
+
+ It("podman manifest remove not-found", func() {
+ session := podmanTest.Podman([]string{"manifest", "create", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "add", "foo", imageList})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "remove", "foo", "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman manifest push", func() {
+ session := podmanTest.Podman([]string{"manifest", "create", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "add", "--all", "foo", imageList})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ dest := filepath.Join(podmanTest.TempDir, "pushed")
+ err := os.MkdirAll(dest, os.ModePerm)
+ Expect(err).To(BeNil())
+ defer func() {
+ os.RemoveAll(dest)
+ }()
+ session = podmanTest.Podman([]string{"manifest", "push", "--all", "foo", "dir:" + dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
+ Expect(err).To(BeNil())
+ check := SystemExec("sha256sum", files)
+ check.WaitWithDefaultTimeout()
+ Expect(check.ExitCode()).To(Equal(0))
+ prefix := "sha256:"
+ Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)))
+ Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListARMInstanceDigest, prefix)))
+ Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListPPC64LEInstanceDigest, prefix)))
+ Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListS390XInstanceDigest, prefix)))
+ Expect(check.OutputToString()).To(ContainSubstring(strings.TrimPrefix(imageListARM64InstanceDigest, prefix)))
+ })
+
+ It("podman manifest push purge", func() {
+ session := podmanTest.Podman([]string{"manifest", "create", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "add", "foo", imageList})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ dest := filepath.Join(podmanTest.TempDir, "pushed")
+ err := os.MkdirAll(dest, os.ModePerm)
+ Expect(err).To(BeNil())
+ defer func() {
+ os.RemoveAll(dest)
+ }()
+ session = podmanTest.Podman([]string{"manifest", "push", "--purge", "foo", "dir:" + dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
})