mirror of
https://github.com/appleboy/drone-ssh.git
synced 2026-06-04 18:24:01 +08:00
chore: support UseInsecureCipher (#158)
This commit is contained in:
@@ -669,3 +669,38 @@ func TestPlugin_scriptCommands(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUseInsecureCipher(t *testing.T) {
|
||||
var (
|
||||
buffer bytes.Buffer
|
||||
expected = `
|
||||
======CMD======
|
||||
mkdir a/b/c
|
||||
mkdir d/e/f
|
||||
======END======
|
||||
err: mkdir: can't create directory 'a/b/c': No such file or directory
|
||||
err: mkdir: can't create directory 'd/e/f': No such file or directory
|
||||
`
|
||||
)
|
||||
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
Host: []string{"localhost"},
|
||||
Username: "drone-scp",
|
||||
Port: 22,
|
||||
KeyPath: "./tests/.ssh/id_rsa",
|
||||
Script: []string{
|
||||
"mkdir a/b/c",
|
||||
"mkdir d/e/f",
|
||||
},
|
||||
CommandTimeout: 10 * time.Second,
|
||||
UseInsecureCipher: true,
|
||||
},
|
||||
Writer: &buffer,
|
||||
}
|
||||
|
||||
err := plugin.Exec()
|
||||
assert.NotNil(t, err)
|
||||
|
||||
assert.Equal(t, unindent(expected), unindent(buffer.String()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user