summaryrefslogtreecommitdiff
path: root/test/e2e/pod_inspect_test.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-07-13 14:22:43 -0400
committerMatthew Heon <mheon@redhat.com>2020-07-14 12:03:11 -0400
commit41457b5a28532d410517b1afb1759e2724d03cab (patch)
tree9d0f6a2e28c8ffdb4366bd3482b2cf5fd255be9e /test/e2e/pod_inspect_test.go
parent210f1040d26334457803bc1da74667f70630a620 (diff)
downloadpodman-41457b5a28532d410517b1afb1759e2724d03cab.tar.gz
podman-41457b5a28532d410517b1afb1759e2724d03cab.tar.bz2
podman-41457b5a28532d410517b1afb1759e2724d03cab.zip
Include infra container information in `pod inspect`
We had a field for this in the inspect data, but it was never being populated. Because of this, `podman pod inspect` stopped showing port bindings (and other infra container settings). Add code to populate the infra container inspect data, and add a test to ensure we don't regress again. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'test/e2e/pod_inspect_test.go')
-rw-r--r--test/e2e/pod_inspect_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 5e3634435..64f943c80 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -3,6 +3,8 @@ package integration
import (
"os"
+ "github.com/containers/libpod/v2/libpod/define"
+
. "github.com/containers/libpod/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -79,4 +81,22 @@ var _ = Describe("Podman pod inspect", func() {
index := len(inspectCreateCommand) - len(createCommand)
Expect(inspectCreateCommand[index:]).To(Equal(createCommand))
})
+
+ It("podman pod inspect outputs port bindings", func() {
+ podName := "testPod"
+ create := podmanTest.Podman([]string{"pod", "create", "--name", testPod, "-p", "8080:80"})
+ create.WaitWithDefaultTimeout()
+ Expect(create.ExitCode()).To(Equal(0))
+
+ inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName})
+ inspectOut.WaitWithDefaultTimeout()
+ Expect(inspectOut.ExitCode()).To(Equal(0))
+
+ inspectJSON := new(define.InspectPodData)
+ err := json.Unmarshal(inspectOut.Out.Contents(), inspectJSON)
+ Expect(err).To(BeNil())
+ Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
+ Expect(len(inspectJSON.PortBindings["80/tcp"])).To(Equal(1))
+ Expect(inspectJSON.PortBindings["80/tcp"].HostPort).To(Equal("8080"))
+ })
})