From bf1213a33359ed62aad5b7b1b0983247de2f4f87 Mon Sep 17 00:00:00 2001 From: Paolo Chila Date: Thu, 20 Jul 2023 19:00:03 +0200 Subject: [PATCH] fixup! Pass go test flags to integration tests --- pkg/testing/define/batch.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/testing/define/batch.go b/pkg/testing/define/batch.go index 965033d5d6d..749e15474b6 100644 --- a/pkg/testing/define/batch.go +++ b/pkg/testing/define/batch.go @@ -83,11 +83,15 @@ func DetermineBatches(dir string, testFlags string, buildTags ...string) ([]Batc if !filepath.IsAbs(dir) && !strings.HasPrefix(dir, "./") { dir = "./" + dir } - flags := strings.SplitN(testFlags, " ", -1) + // run 'go test' and collect the JSON output to be parsed // #nosec G204 -- test function code, it will be okay cmdArgs := []string{"test", "-v", "--tags", strings.Join(buildTags, ","), "-json"} - cmdArgs = append(cmdArgs, flags...) + if testFlags != "" { + flags := strings.Split(testFlags, " ") + cmdArgs = append(cmdArgs, flags...) + } + cmdArgs = append(cmdArgs, dir) testCmd := exec.Command("go", cmdArgs...) output, err := testCmd.Output()