diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-11 03:03:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 03:03:31 -0400 |
commit | c379014ee4e57dc19669ae92f45f8e4c0814295b (patch) | |
tree | 10ea46b3a202da6caa1f6761704d30c67b6e8baf /pkg/machine/e2e/inspect_test.go | |
parent | ed1ba27f8dc33672e8361c6c1a71cf95b1b79e9a (diff) | |
parent | c7c00ce55199c1e569953a4a03055268ecca147e (diff) | |
download | podman-c379014ee4e57dc19669ae92f45f8e4c0814295b.tar.gz podman-c379014ee4e57dc19669ae92f45f8e4c0814295b.tar.bz2 podman-c379014ee4e57dc19669ae92f45f8e4c0814295b.zip |
Merge pull request #14170 from ashley-cui/machtests
Add more machine tests
Diffstat (limited to 'pkg/machine/e2e/inspect_test.go')
-rw-r--r-- | pkg/machine/e2e/inspect_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/machine/e2e/inspect_test.go b/pkg/machine/e2e/inspect_test.go index b34285dd8..2c9de5664 100644 --- a/pkg/machine/e2e/inspect_test.go +++ b/pkg/machine/e2e/inspect_test.go @@ -3,7 +3,9 @@ package e2e import ( "encoding/json" + "github.com/containers/podman/v4/pkg/machine" "github.com/containers/podman/v4/pkg/machine/qemu" + jsoniter "github.com/json-iterator/go" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -67,4 +69,29 @@ var _ = Describe("podman machine stop", func() { // mb.names = []string{} }) + + It("inspect with go format", func() { + name := randomString(12) + i := new(initMachine) + session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run() + Expect(err).To(BeNil()) + Expect(session).To(Exit(0)) + + // regular inspect should + inspectJson := new(inspectMachine) + inspectSession, err := mb.setName(name).setCmd(inspectJson).run() + Expect(err).To(BeNil()) + Expect(inspectSession).To(Exit(0)) + + var inspectInfo []machine.InspectInfo + err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo) + Expect(err).To(BeNil()) + + inspect := new(inspectMachine) + inspect = inspect.withFormat("{{.Name}}") + inspectSession, err = mb.setName(name).setCmd(inspect).run() + Expect(err).To(BeNil()) + Expect(inspectSession).To(Exit(0)) + Expect(inspectSession.Bytes()).To(ContainSubstring(name)) + }) }) |