mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-07-05 22:02:49 +08:00
Add tests forcing IPv4 or IPv6
This commit is contained in:
parent
f63d64212e
commit
278911c997
@ -113,6 +113,40 @@ func TestSSHScriptFromKeyFile(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestSSHIPv4Only(t *testing.T) {
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
Host: []string{"localhost", "127.0.0.1"},
|
||||
Username: "drone-scp",
|
||||
Port: 22,
|
||||
Protocol: easyssh.PROTOCOL_TCP4,
|
||||
KeyPath: "./tests/.ssh/id_rsa",
|
||||
Script: []string{"whoami", "ls -al"},
|
||||
CommandTimeout: 60 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
err := plugin.Exec()
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestSSHIPv6OnlyError(t *testing.T) {
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
Host: []string{"127.0.0.1"},
|
||||
Username: "drone-scp",
|
||||
Port: 22,
|
||||
Protocol: easyssh.PROTOCOL_TCP6,
|
||||
KeyPath: "./tests/.ssh/id_rsa",
|
||||
Script: []string{"whoami", "ls -al"},
|
||||
CommandTimeout: 60 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
err := plugin.Exec()
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestStreamFromSSHCommand(t *testing.T) {
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
|
Loading…
Reference in New Issue
Block a user