summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-12-06 16:45:58 -0700
committerJhon Honce <jhonce@redhat.com>2022-01-14 16:13:35 -0700
commit8a7e70919f4bab0757523ae97c170396cb13c83d (patch)
tree0ec2b5aa4e3c1e6574e606a0e7db3638fdeda578 /test/e2e
parentec2b213ab611cb197e86c45d03fb10af667ad95c (diff)
downloadpodman-8a7e70919f4bab0757523ae97c170396cb13c83d.tar.gz
podman-8a7e70919f4bab0757523ae97c170396cb13c83d.tar.bz2
podman-8a7e70919f4bab0757523ae97c170396cb13c83d.zip
Refactor manifest list operations
* Update method/function signatures use the manifest list name and images associated with the operation explicitly, in general func f(ctx context.Context, manifestListName string, ImageNames []string, options *fOptions) * Leverage gorilla/mux Subrouters to support API v3.x and v4.x for manifests * Make manifest API endpoints more RESTful * Add PUT /manifest/{id} to update existing manifests * Add manifests.Annotate to go bindings, uncommented unit test * Add DELETE /manifest/{Id} to remove existing manifest list, use PUT /manifest/{id} to remove images from a list * Deprecated POST /manifest/{id}/add and /manifest/{id}/remove, use PUT /manifest/{id} instead * Corrected swagger godoc and updated to cover API changes * Update podman manifest commands to use registry.Context() * Expose utils.GetVar() to obtain query parameters by name * Unexpose server.registerSwaggerHandlers, not sure why this was ever exposed. * Refactored code to use http.Header instead of map[string]string when operating on HTTP headers. * Add API-Version header support in bindings to allow calling explicate versions of the API. Header is _NOT_ forwarded to the API service. Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/libpod_suite_remote_test.go4
-rw-r--r--test/e2e/manifest_test.go103
2 files changed, 59 insertions, 48 deletions
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 4644e3748..53e1fc8f2 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -80,7 +80,7 @@ func (p *PodmanTestIntegration) StartRemoteService() {
args := []string{}
if _, found := os.LookupEnv("DEBUG_SERVICE"); found {
- args = append(args, "--log-level", "debug")
+ args = append(args, "--log-level", "trace")
}
remoteSocket := p.RemoteSocket
args = append(args, "system", "service", "--time", "0", remoteSocket)
@@ -151,7 +151,7 @@ func (p *PodmanTestIntegration) StopRemoteService() {
}
}
-//MakeOptions assembles all the podman main options
+// MakeOptions assembles all the podman main options
func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
p.Root, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 5978214ff..b86d5ecbe 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -44,19 +44,19 @@ var _ = Describe("Podman manifest", func() {
processTestResult(f)
})
- It("podman manifest create", func() {
+ It("create w/o image", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
- It("podman manifest create", func() {
+ It("create w/ image", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo", imageList})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
- It("podman manifest inspect", func() {
+ It("inspect", func() {
session := podmanTest.Podman([]string{"manifest", "inspect", BB})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -71,29 +71,27 @@ var _ = Describe("Podman manifest", func() {
Expect(session).Should(Exit(0))
})
- It("podman manifest add", func() {
+ It("add w/ inspect", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"manifest", "add", "--arch=arm64", "foo", imageListInstance})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- })
+ id := strings.TrimSpace(string(session.Out.Contents()))
- It("podman manifest add one", func() {
- session := podmanTest.Podman([]string{"manifest", "create", "foo"})
+ session = podmanTest.Podman([]string{"manifest", "inspect", id})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+
session = podmanTest.Podman([]string{"manifest", "add", "--arch=arm64", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
})
- It("podman manifest tag", func() {
+ It("tag", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foobar"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -112,7 +110,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session2.OutputToString()).To(Equal(session.OutputToString()))
})
- It("podman manifest add --all", func() {
+ It(" add --all", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -122,14 +120,17 @@ var _ = Describe("Podman manifest", func() {
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(ContainSubstring(imageListAMD64InstanceDigest))
- Expect(session.OutputToString()).To(ContainSubstring(imageListARMInstanceDigest))
- Expect(session.OutputToString()).To(ContainSubstring(imageListARM64InstanceDigest))
- Expect(session.OutputToString()).To(ContainSubstring(imageListPPC64LEInstanceDigest))
- Expect(session.OutputToString()).To(ContainSubstring(imageListS390XInstanceDigest))
+ Expect(session.OutputToString()).To(
+ And(
+ ContainSubstring(imageListAMD64InstanceDigest),
+ ContainSubstring(imageListARMInstanceDigest),
+ ContainSubstring(imageListARM64InstanceDigest),
+ ContainSubstring(imageListPPC64LEInstanceDigest),
+ ContainSubstring(imageListS390XInstanceDigest),
+ ))
})
- It("podman manifest add --os", func() {
+ It("add --os", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -142,7 +143,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session.OutputToString()).To(ContainSubstring(`"os": "bar"`))
})
- It("podman manifest annotate", func() {
+ It("annotate", func() {
SkipIfRemote("Not supporting annotate on remote connections")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
@@ -159,7 +160,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`))
})
- It("podman manifest remove", func() {
+ It("remove digest", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -176,14 +177,18 @@ var _ = Describe("Podman manifest", func() {
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(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)))
+ Expect(session.OutputToString()).To(
+ And(
+ ContainSubstring(imageListAMD64InstanceDigest),
+ ContainSubstring(imageListARMInstanceDigest),
+ ContainSubstring(imageListPPC64LEInstanceDigest),
+ ContainSubstring(imageListS390XInstanceDigest),
+ Not(
+ ContainSubstring(imageListARM64InstanceDigest)),
+ ))
})
- It("podman manifest remove not-found", func() {
+ It("remove not-found", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -199,7 +204,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session).Should(Exit(0))
})
- It("podman manifest push", func() {
+ It("push --all", func() {
SkipIfRemote("manifest push to dir not supported in remote mode")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
@@ -216,20 +221,24 @@ var _ = Describe("Podman manifest", func() {
session = podmanTest.Podman([]string{"manifest", "push", "--all", "foo", "dir:" + dest})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+
files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
- Expect(err).To(BeNil())
+ Expect(err).ShouldNot(HaveOccurred())
check := SystemExec("sha256sum", files)
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(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)))
+ Expect(check.OutputToString()).To(
+ And(
+ ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListARMInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListPPC64LEInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListS390XInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListARM64InstanceDigest, prefix)),
+ ))
})
- It("podman push --all", func() {
+ It("push", func() {
SkipIfRemote("manifest push to dir not supported in remote mode")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
@@ -251,15 +260,19 @@ var _ = Describe("Podman manifest", func() {
check := SystemExec("sha256sum", files)
check.WaitWithDefaultTimeout()
Expect(check).Should(Exit(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)))
+ Expect(check.OutputToString()).To(
+ And(
+ ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListARMInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListPPC64LEInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListS390XInstanceDigest, prefix)),
+ ContainSubstring(strings.TrimPrefix(imageListARM64InstanceDigest, prefix)),
+ ))
})
- It("podman manifest push --rm", func() {
+ It("push --rm", func() {
SkipIfRemote("remote does not support --rm")
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
session.WaitWithDefaultTimeout()
@@ -285,7 +298,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session).To(ExitWithError())
})
- It("podman manifest exists", func() {
+ It("exists", func() {
manifestList := "manifest-list"
session := podmanTest.Podman([]string{"manifest", "create", manifestList})
session.WaitWithDefaultTimeout()
@@ -300,7 +313,7 @@ var _ = Describe("Podman manifest", func() {
Expect(session).Should(Exit(1))
})
- It("podman manifest rm should not remove referenced images", func() {
+ It("rm should not remove referenced images", func() {
manifestList := "manifestlist"
imageName := "quay.io/libpod/busybox"
@@ -320,11 +333,9 @@ var _ = Describe("Podman manifest", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- //image should still show up
- session = podmanTest.Podman([]string{"images"})
+ // image should still show up
+ session = podmanTest.Podman([]string{"image", "exists", imageName})
session.WaitWithDefaultTimeout()
- Expect(session.OutputToString()).To(ContainSubstring(imageName))
Expect(session).Should(Exit(0))
})
-
})