mirror of
https://github.com/containers/podman.git
synced 2025-12-05 21:32:22 +08:00
Merge pull request #15675 from Luap99/pod-inspect
fix podman pod inspect to support multiple pods
This commit is contained in:
@@ -571,7 +571,7 @@ func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectCont
|
||||
func (s *PodmanSessionIntegration) InspectPodToJSON() define.InspectPodData {
|
||||
var i define.InspectPodData
|
||||
err := jsoniter.Unmarshal(s.Out.Contents(), &i)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return i
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user