From 26b3d47ee2b7bd86fdff5bf78aee0e85beb2f83a Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 13 May 2017 13:47:00 +0800 Subject: [PATCH] add exit code example. Signed-off-by: Bo-Yi Wu --- plugin_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugin_test.go b/plugin_test.go index de3e771..8fe9709 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -207,3 +207,25 @@ func TestSSHCommandError(t *testing.T) { err := plugin.Exec() assert.NotNil(t, err) } + +func TestSSHCommandExitCodeError(t *testing.T) { + plugin := Plugin{ + Config: Config{ + Host: []string{"localhost"}, + UserName: "drone-scp", + Port: 22, + KeyPath: "./tests/.ssh/id_rsa", + Script: []string{ + "set -e", + "echo 1", + "mkdir a", + "mkdir a", + "echo 2", + }, + CommandTimeout: 60, + }, + } + + err := plugin.Exec() + assert.NotNil(t, err) +}