update testing for remove single dest file. (#55)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2017-03-25 23:05:13 +08:00
committed by GitHub
parent d326bfe5a4
commit 6aa6653378
2 changed files with 32 additions and 1 deletions
+27
View File
@@ -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)
}