2024-04-29 21:29:05 +02:00
|
|
|
package pkg
|
2023-02-26 16:07:14 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-04-29 21:29:05 +02:00
|
|
|
"gitea.urkob.com/urko/git-webhook-ci/kit/cfg"
|
2023-02-26 16:07:14 +01:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
binaryPath = "/bin/bash"
|
2023-02-26 16:59:20 +01:00
|
|
|
scriptPath = cfg.RootDir() + "/test-script.sh"
|
2023-02-26 16:07:14 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDeploy(t *testing.T) {
|
|
|
|
err := Deploy(binaryPath, scriptPath)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDeployError(t *testing.T) {
|
|
|
|
err := Deploy("", "")
|
|
|
|
require.Error(t, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExecute(t *testing.T) {
|
|
|
|
err := execute(binaryPath, scriptPath)
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExecuteError(t *testing.T) {
|
|
|
|
err := execute("", "")
|
|
|
|
require.Error(t, err)
|
|
|
|
}
|