Merge pull request #1844 from alixander/test-name-flag

add test name flag to test report
This commit is contained in:
Alexander Wang 2024-02-23 12:31:57 -08:00 committed by GitHub
commit 5117d2b077
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,9 +37,11 @@ func main() {
vFlag := false vFlag := false
testCaseFlag := "" testCaseFlag := ""
testSetFlag := "" testSetFlag := ""
testNameFlag := ""
cpuProfileFlag := false cpuProfileFlag := false
memProfileFlag := false memProfileFlag := false
flag.BoolVar(&deltaFlag, "delta", false, "Generate the report only for cases that changed.") flag.BoolVar(&deltaFlag, "delta", false, "Generate the report only for cases that changed.")
flag.StringVar(&testNameFlag, "test-name", "E2E", "Name of e2e tests. Defaults to E2E")
flag.StringVar(&testSetFlag, "test-set", "", "Only run set of tests matching this string. e.g. regressions") flag.StringVar(&testSetFlag, "test-set", "", "Only run set of tests matching this string. e.g. regressions")
flag.StringVar(&testCaseFlag, "test-case", "", "Only run tests matching this string. e.g. all_shapes") flag.StringVar(&testCaseFlag, "test-case", "", "Only run tests matching this string. e.g. all_shapes")
flag.BoolVar(&cpuProfileFlag, "cpuprofile", false, "Profile test cpu usage. `go tool pprof out/cpu.prof`") flag.BoolVar(&cpuProfileFlag, "cpuprofile", false, "Profile test cpu usage. `go tool pprof out/cpu.prof`")
@ -52,7 +54,7 @@ func main() {
if vFlag { if vFlag {
vString = "-v" vString = "-v"
} }
testMatchString := fmt.Sprintf("-run=TestE2E/%s/%s", testSetFlag, testCaseFlag) testMatchString := fmt.Sprintf("-run=Test%s/%s/%s", testNameFlag, testSetFlag, testCaseFlag)
cpuProfileStr := "" cpuProfileStr := ""
if cpuProfileFlag { if cpuProfileFlag {