Add test to fix coverage

The test should anaylize the output of the command to make sure it worked but I didn't find any suitable function
This commit is contained in:
Martino Facchin 2017-07-24 19:22:41 +02:00
parent 4b6bf763c8
commit b6c3a4ffbe

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"os"
"testing" "testing"
"github.com/appleboy/easyssh-proxy" "github.com/appleboy/easyssh-proxy"
@ -137,6 +138,23 @@ func TestStreamFromSSHCommand(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
} }
func TestDroneEnvSubstitution(t *testing.T) {
os.Setenv("DRONE_DEPLOY_TO", "dev")
plugin := Plugin{
Config: Config{
Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp",
Port: 22,
KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"echo $DRONE_DEPLOY_TO $PATH"},
CommandTimeout: 60,
},
}
err := plugin.Exec()
assert.Nil(t, err)
}
func TestSSHScriptWithError(t *testing.T) { func TestSSHScriptWithError(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{