diff options
author | Brent Baude <bbaude@redhat.com> | 2022-04-27 15:16:25 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2022-04-27 15:44:02 -0500 |
commit | 83a75d2a3d6a6dd0661f1f44aff13639412c390b (patch) | |
tree | 530f5907adac30a42e5eac1f584d13d90f994d5e /pkg/machine/e2e/ssh_test.go | |
parent | 60d6cc8e1eb33be2f9822e227a7cadf0dceb5543 (diff) | |
download | podman-83a75d2a3d6a6dd0661f1f44aff13639412c390b.tar.gz podman-83a75d2a3d6a6dd0661f1f44aff13639412c390b.tar.bz2 podman-83a75d2a3d6a6dd0661f1f44aff13639412c390b.zip |
Produce better test error messages
As Ed has pointed out, the form of Expect(session).To(Exit(0)) provides
much better error messages. Let's make Ed happy.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/machine/e2e/ssh_test.go')
-rw-r--r-- | pkg/machine/e2e/ssh_test.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/machine/e2e/ssh_test.go b/pkg/machine/e2e/ssh_test.go index 90296fa10..155d39a64 100644 --- a/pkg/machine/e2e/ssh_test.go +++ b/pkg/machine/e2e/ssh_test.go @@ -3,6 +3,7 @@ package e2e import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var _ = Describe("podman machine ssh", func() { @@ -23,7 +24,7 @@ var _ = Describe("podman machine ssh", func() { ssh := sshMachine{} session, err := mb.setName(name).setCmd(ssh).run() Expect(err).To(BeNil()) - Expect(session.ExitCode()).To(Equal(125)) + Expect(session).To(Exit(125)) // TODO seems like stderr is not being returned; re-enabled when fixed //Expect(session.outputToString()).To(ContainSubstring("not exist")) }) @@ -33,14 +34,14 @@ var _ = Describe("podman machine ssh", func() { i := new(initMachine) session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run() Expect(err).To(BeNil()) - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).To(Exit(0)) ssh := sshMachine{} sshSession, err := mb.setName(name).setCmd(ssh).run() Expect(err).To(BeNil()) // TODO seems like stderr is not being returned; re-enabled when fixed //Expect(sshSession.outputToString()).To(ContainSubstring("is not running")) - Expect(sshSession.ExitCode()).To(Equal(125)) + Expect(sshSession).To(Exit(125)) }) It("ssh to running machine and check os-type", func() { @@ -48,12 +49,12 @@ var _ = Describe("podman machine ssh", func() { i := new(initMachine) session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run() Expect(err).To(BeNil()) - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).To(Exit(0)) ssh := sshMachine{} sshSession, err := mb.setName(name).setCmd(ssh.withSSHComand([]string{"cat", "/etc/os-release"})).run() Expect(err).To(BeNil()) - Expect(sshSession.ExitCode()).To(Equal(0)) + Expect(sshSession).To(Exit(0)) Expect(sshSession.outputToString()).To(ContainSubstring("Fedora CoreOS")) }) }) |