aboutsummaryrefslogtreecommitdiff
path: root/pkg/machine/e2e/ssh_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-05-30 15:15:57 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-05-30 15:55:20 +0200
commit0e58636c3a599bb3d7d5ef06ab2773befe8a0150 (patch)
tree42435d07701510a6c7dd8bd4bbcbb5720f52b4ae /pkg/machine/e2e/ssh_test.go
parenta6f8cad545fa3242a2778c9a0d25da4da0a51ce2 (diff)
downloadpodman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.tar.gz
podman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.tar.bz2
podman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.zip
podman machine ssh: set correct exit code
Forward the ssh exit code to the podman caller. This is useful for scripts. Use the same logic as podman unshare. Fixes #14401 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/machine/e2e/ssh_test.go')
-rw-r--r--pkg/machine/e2e/ssh_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/machine/e2e/ssh_test.go b/pkg/machine/e2e/ssh_test.go
index 155d39a64..9ee31ac26 100644
--- a/pkg/machine/e2e/ssh_test.go
+++ b/pkg/machine/e2e/ssh_test.go
@@ -56,5 +56,12 @@ var _ = Describe("podman machine ssh", func() {
Expect(err).To(BeNil())
Expect(sshSession).To(Exit(0))
Expect(sshSession.outputToString()).To(ContainSubstring("Fedora CoreOS"))
+
+ // keep exit code
+ sshSession, err = mb.setName(name).setCmd(ssh.withSSHComand([]string{"false"})).run()
+ Expect(err).To(BeNil())
+ Expect(sshSession).To(Exit(1))
+ Expect(sshSession.outputToString()).To(Equal(""))
+ Expect(sshSession.errorToString()).To(Equal(""))
})
})