mirror of https://gitlab.com/gitlab-org/cli.git
test: support forks CI in automated tests
This commit is contained in:
parent
21025017a9
commit
343f225203
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue