summaryrefslogtreecommitdiff
path: root/test/e2e/inspect_test.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-12-07 15:34:14 -0700
committerJhon Honce <jhonce@redhat.com>2020-12-07 15:39:43 -0700
commitce474788fd9bcecdb1cd6730fecd16e5d8840ae5 (patch)
tree1ddff0e68cb8a53244956212947cd8b37a301d87 /test/e2e/inspect_test.go
parente2f91207fc3e515c0a9f828433aaf80727f4b7c5 (diff)
downloadpodman-ce474788fd9bcecdb1cd6730fecd16e5d8840ae5.tar.gz
podman-ce474788fd9bcecdb1cd6730fecd16e5d8840ae5.tar.bz2
podman-ce474788fd9bcecdb1cd6730fecd16e5d8840ae5.zip
Restore json format for fields as well as whole structs
* Add template func to inspect template processing * Added test using repro from #8444 Fixes #8444 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/e2e/inspect_test.go')
-rw-r--r--test/e2e/inspect_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index c2e0f4407..97f77414e 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -7,6 +7,7 @@ import (
. "github.com/containers/podman/v2/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
"github.com/opencontainers/selinux/go-selinux"
)
@@ -428,4 +429,18 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).To(ExitWithError())
})
+ // Fixes https://github.com/containers/podman/issues/8444
+ It("podman inspect --format json .NetworkSettings.Ports", func() {
+ ctnrName := "Ctnr_" + RandomString(25)
+
+ create := podmanTest.Podman([]string{"create", "--name", ctnrName, "-p", "8080:80", ALPINE})
+ create.WaitWithDefaultTimeout()
+ Expect(create).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", `--format="{{json .NetworkSettings.Ports}}"`, ctnrName})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal(`"{"80/tcp":[{"HostIp":"","HostPort":"8080"}]}"`))
+ })
+
})