add exit code example.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-05-13 13:47:00 +08:00
parent 0a78278313
commit 26b3d47ee2
No known key found for this signature in database
GPG Key ID: 0F84B2110C500B1F

View File

@ -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)
}