diff --git a/pkg/cmd/bazci/githubpost/githubpost.go b/pkg/cmd/bazci/githubpost/githubpost.go index d46ce6de8222..804f6fdfabc6 100644 --- a/pkg/cmd/bazci/githubpost/githubpost.go +++ b/pkg/cmd/bazci/githubpost/githubpost.go @@ -536,12 +536,28 @@ func listFailuresFromTestXML( fmt.Printf("couldn't parse time %s as float64: %+v\n", testCase.Time, err) } } - event := testEvent{ - Action: "fail", - Package: pkg, - Test: testCase.Name, - Output: result.Contents, - Elapsed: elapsed, + var event testEvent + if pkg == testCase.Name { + // Test case or suite name is potentially irregular and does not + // match the expected format. Test binary may not have successfully + // executed or encountered some other error. We will make a special + // testEvent for this case. + // See unit tests for an example. See #159708 for more details. + log.Printf("encountered xml with non fully qualified test failure(s) %s and test suite(s) %s", pkg, testCase.Name) + event = testEvent{ + Package: pkg, + Test: testCase.Name, + Output: fmt.Sprintf("Test binary potentially failed to execute because of bazel test timeout,"+ + " init() issue, or some other error. Content: %s", result.Contents), + } + } else { + event = testEvent{ + Action: "fail", + Package: pkg, + Test: testCase.Name, + Output: result.Contents, + Elapsed: elapsed, + } } failures[key] = append(failures[key], event) } diff --git a/pkg/cmd/bazci/githubpost/githubpost_test.go b/pkg/cmd/bazci/githubpost/githubpost_test.go index 2f4db10a183b..46074dcc4a27 100644 --- a/pkg/cmd/bazci/githubpost/githubpost_test.go +++ b/pkg/cmd/bazci/githubpost/githubpost_test.go @@ -408,6 +408,15 @@ func TestListFailuresFromTestXML(t *testing.T) { mention: []string{"@cockroachdb/unowned"}, }}, }, + { + fileName: "test-error-142.xml", // #159708 case + expPkg: "pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test", + expIssues: []issue{{ + testName: "pkg", + title: "pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test: pkg failed", + message: `Test binary potentially failed to execute because of bazel test timeout, init() issue, or some other error.`, + }}, + }, } for _, c := range testCases { diff --git a/pkg/cmd/bazci/githubpost/testdata/test-error-142.xml b/pkg/cmd/bazci/githubpost/testdata/test-error-142.xml new file mode 100644 index 000000000000..da415e63e535 --- /dev/null +++ b/pkg/cmd/bazci/githubpost/testdata/test-error-142.xml @@ -0,0 +1,8 @@ + + + + + + +