mirror of
https://github.com/appleboy/drone-scp.git
synced 2026-06-04 18:23:59 +08:00
update testing for remove single dest file. (#55)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -289,3 +289,30 @@ func TestGlobList(t *testing.T) {
|
||||
expects = []string{"tests/b.txt"}
|
||||
assert.Equal(t, expects, globList(paterns))
|
||||
}
|
||||
|
||||
func TestRemoveDestFile(t *testing.T) {
|
||||
ssh := &easyssh.MakeConfig{
|
||||
Server: "localhost",
|
||||
User: "drone-scp",
|
||||
Port: "22",
|
||||
KeyPath: "tests/.ssh/id_rsa",
|
||||
// io timeout
|
||||
Timeout: 1,
|
||||
}
|
||||
plugin := Plugin{
|
||||
Config: Config{
|
||||
CommandTimeout: 60,
|
||||
},
|
||||
DestFile: "/etc/resolv.conf",
|
||||
}
|
||||
|
||||
// ssh io timeout
|
||||
err := plugin.removeDestFile(ssh)
|
||||
assert.Error(t, err)
|
||||
|
||||
ssh.Timeout = 0
|
||||
|
||||
// permission denied
|
||||
err = plugin.removeDestFile(ssh)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user