Skip to content

Commit

Permalink
fixup! fixup! fixup! Pass go test flags to integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pchila committed Jul 25, 2023
1 parent 4c0a8b9 commit 1bb7bc8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,11 @@ func (Integration) TestOnRemote(ctx context.Context) error {
return errors.New("TEST_DEFINE_TESTS environment variable must be set")
}

goTestFlags := strings.SplitN(os.Getenv("GOTEST_FLAGS"), " ", -1)
var goTestFlags []string
rawTestFlags := os.Getenv("GOTEST_FLAGS")
if rawTestFlags != "" {
goTestFlags = strings.Split(rawTestFlags, " ")
}

tests := strings.Split(testsStr, ",")
testsByPackage := make(map[string][]string)
Expand Down Expand Up @@ -1433,7 +1437,9 @@ func (Integration) TestOnRemote(ctx context.Context) error {
testName := fmt.Sprintf("remote-%s", testPrefix)
fileName := fmt.Sprintf("build/TEST-go-%s", testName)
extraFlags := make([]string, 0, len(goTestFlags)+3)
extraFlags = append(extraFlags, goTestFlags...)
if len(goTestFlags) > 0 {
extraFlags = append(extraFlags, goTestFlags...)
}
extraFlags = append(extraFlags, "-test.shuffle", "on",
"-test.timeout", "0", "-test.run", "'^("+strings.Join(packageTests, "|")+")$'")
params := mage.GoTestArgs{
Expand Down

0 comments on commit 1bb7bc8

Please sign in to comment.