mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
test: improve testing.
This commit is contained in:
parent
876c4c1cee
commit
95f777f22e
@ -138,14 +138,30 @@ func TestWrongKeyFormat(t *testing.T) {
|
|||||||
func TestSSHScriptFromKeyFile(t *testing.T) {
|
func TestSSHScriptFromKeyFile(t *testing.T) {
|
||||||
plugin := Plugin{
|
plugin := Plugin{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
Host: []string{"localhost"},
|
Host: []string{"localhost", "127.0.0.1"},
|
||||||
User: "drone-scp",
|
User: "drone-scp",
|
||||||
Port: 22,
|
Port: 22,
|
||||||
KeyPath: "./tests/.ssh/id_rsa",
|
KeyPath: "./tests/.ssh/id_rsa",
|
||||||
Script: []string{"whoami"},
|
Script: []string{"whoami"},
|
||||||
|
Sleep: 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err := plugin.Exec()
|
err := plugin.Exec()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSSHScriptRunError(t *testing.T) {
|
||||||
|
plugin := Plugin{
|
||||||
|
Config: Config{
|
||||||
|
Host: []string{"localhost"},
|
||||||
|
User: "drone-scp",
|
||||||
|
Port: 22,
|
||||||
|
KeyPath: "./tests/.ssh/id_rsa",
|
||||||
|
Script: []string{"whoami", "whoam"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
err := plugin.Exec()
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user