chore: support UseInsecureCipher (#158)

This commit is contained in:
Bo-Yi Wu
2020-05-24 10:43:11 +08:00
committed by GitHub
parent 1288a4b20d
commit 7344ac6529
5 changed files with 116 additions and 67 deletions
+35
View File
@@ -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()))
}