summaryrefslogtreecommitdiff
path: root/test/e2e/pod_inspect_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-09-07 18:31:23 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-09-08 10:28:42 +0200
commitd10e77e1bcd25306ab8afd4ce7da16eed3c67840 (patch)
treed0f95b1fee3f30b89f5e4d4eb4a9d21a49738b48 /test/e2e/pod_inspect_test.go
parente46bcd72f8d6528dbafb1ad1b34abeb0177a8b77 (diff)
downloadpodman-d10e77e1bcd25306ab8afd4ce7da16eed3c67840.tar.gz
podman-d10e77e1bcd25306ab8afd4ce7da16eed3c67840.tar.bz2
podman-d10e77e1bcd25306ab8afd4ce7da16eed3c67840.zip
fix podman pod inspect to support multiple pods
Just like the other inspect commands `podman pod inspect p1 p2` should return the json for both. To correctly implement this we follow the container inspect logic, this allows use to reuse the global inspect command. Note: To not break the existing single pod output format for podman pod inspect I added a pod-legacy inspect type. This is only used to make sure we will print the pod as single json and not an array like for the other commands. We cannot use the pod type since podman inspect --type pod did return an array and we should not break that as well. Fixes #15674 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/e2e/pod_inspect_test.go')
-rw-r--r--test/e2e/pod_inspect_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 351317cc5..cefdee40a 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -118,4 +118,21 @@ var _ = Describe("Podman pod inspect", func() {
Expect(inspectOut.OutputToString()).To(ContainSubstring(macAddr))
})
+
+ It("podman inspect two pods", func() {
+ _, ec, podid1 := podmanTest.CreatePod(nil)
+ Expect(ec).To(Equal(0))
+
+ _, ec, podid2 := podmanTest.CreatePod(nil)
+ Expect(ec).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"pod", "inspect", podid1, podid2})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(BeValidJSON())
+ podData := inspect.InspectPodArrToJSON()
+ Expect(podData).To(HaveLen(2))
+ Expect(podData[0]).To(HaveField("ID", podid1))
+ Expect(podData[1]).To(HaveField("ID", podid2))
+ })
})