test: support forks CI in automated tests

This commit is contained in:
Tomas Vik 2022-06-10 14:20:44 +02:00
parent 21025017a9
commit 343f225203
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package git
import (
"os"
"os/exec"
"reflect"
"testing"
@ -13,6 +14,13 @@ import (
"github.com/stretchr/testify/require"
)
func getEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}
func Test_isFilesystemPath(t *testing.T) {
type args struct {
p string
@ -291,7 +299,7 @@ func TestGetRemoteURL(t *testing.T) {
{
name: "isInvalid",
remoteAlias: "origin",
want: "gitlab-org/cli",
want: getEnv("CI_PROJECT_PATH","gitlab-org/cli"),
},
}
for _, tt := range tests {