diff options
author | Jhon Honce <jhonce@redhat.com> | 2022-05-03 10:51:58 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2022-05-03 16:15:59 -0700 |
commit | 88015cf0d8c62e27452899c870555667d658427f (patch) | |
tree | d9708a4860381b4a29034811c3253c6096d94df8 /pkg/machine/e2e | |
parent | 1e0c50df38ff955011f7ebb83a0268f3f1cd2841 (diff) | |
download | podman-88015cf0d8c62e27452899c870555667d658427f.tar.gz podman-88015cf0d8c62e27452899c870555667d658427f.tar.bz2 podman-88015cf0d8c62e27452899c870555667d658427f.zip |
Implement --format for machine inspect
* Fix issue of nil pointer derefence
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/machine/e2e')
-rw-r--r-- | pkg/machine/e2e/inspect_test.go | 12 | ||||
-rw-r--r-- | pkg/machine/e2e/machine_test.go | 11 |
2 files changed, 16 insertions, 7 deletions
diff --git a/pkg/machine/e2e/inspect_test.go b/pkg/machine/e2e/inspect_test.go index e282dd21d..b34285dd8 100644 --- a/pkg/machine/e2e/inspect_test.go +++ b/pkg/machine/e2e/inspect_test.go @@ -43,9 +43,11 @@ var _ = Describe("podman machine stop", func() { Expect(foo2).To(Exit(0)) inspect := new(inspectMachine) + inspect = inspect.withFormat("{{.Name}}") inspectSession, err := mb.setName("foo1").setCmd(inspect).run() Expect(err).To(BeNil()) Expect(inspectSession).To(Exit(0)) + Expect(inspectSession.Bytes()).To(ContainSubstring("foo1")) type fakeInfos struct { Status string @@ -56,13 +58,13 @@ var _ = Describe("podman machine stop", func() { Expect(err).ToNot(HaveOccurred()) Expect(len(infos)).To(Equal(2)) - //rm := new(rmMachine) - //// Must manually clean up due to multiple names - //for _, name := range []string{"foo1", "foo2"} { + // rm := new(rmMachine) + // // Must manually clean up due to multiple names + // for _, name := range []string{"foo1", "foo2"} { // mb.setName(name).setCmd(rm.withForce()).run() // mb.names = []string{} - //} - //mb.names = []string{} + // } + // mb.names = []string{} }) }) diff --git a/pkg/machine/e2e/machine_test.go b/pkg/machine/e2e/machine_test.go index 2b3b60b2b..657014b05 100644 --- a/pkg/machine/e2e/machine_test.go +++ b/pkg/machine/e2e/machine_test.go @@ -23,14 +23,20 @@ func TestMain(m *testing.M) { const ( defaultStream string = "podman-testing" - tmpDir string = "/var/tmp" ) var ( + tmpDir = "/var/tmp" fqImageName string suiteImageName string ) +func init() { + if value, ok := os.LookupEnv("TMPDIR"); ok { + tmpDir = value + } +} + // TestLibpod ginkgo master function func TestMachine(t *testing.T) { RegisterFailHandler(Fail) @@ -70,7 +76,8 @@ var _ = SynchronizedAfterSuite(func() {}, }) func setup() (string, *machineTestBuilder) { - homeDir, err := ioutil.TempDir("/var/tmp", "podman_test") + // Set TMPDIR if this needs a new directory + homeDir, err := ioutil.TempDir("", "podman_test") if err != nil { Fail(fmt.Sprintf("failed to create home directory: %q", err)) } |