Skip to content

Commit d1ec51d

Browse files
committed
bazci: improve github issues when test.xml does not contain fully qualified
unit test names Epic: None Release note: None
1 parent 0ae70f1 commit d1ec51d

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

pkg/cmd/bazci/githubpost/githubpost.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,28 @@ func listFailuresFromTestXML(
536536
fmt.Printf("couldn't parse time %s as float64: %+v\n", testCase.Time, err)
537537
}
538538
}
539-
event := testEvent{
540-
Action: "fail",
541-
Package: pkg,
542-
Test: testCase.Name,
543-
Output: result.Contents,
544-
Elapsed: elapsed,
539+
var event testEvent
540+
if pkg == testCase.Name {
541+
// Test case or suite name is potentially irregular and does not
542+
// match the expected format. Test binary may not have successfully
543+
// executed or encountered some other error. We will make a special
544+
// testEvent for this case.
545+
// See unit tests for an example. See #159708 for more details.
546+
log.Printf("encountered xml with non fully qualified test failure(s) %s and test suite(s) %s", pkg, testCase.Name)
547+
event = testEvent{
548+
Package: pkg,
549+
Test: testCase.Name,
550+
Output: fmt.Sprintf("Test binary potentially failed to execute because of bazel test timeout,"+
551+
" init() issue, or some other error. Content: %s", result.Contents),
552+
}
553+
} else {
554+
event = testEvent{
555+
Action: "fail",
556+
Package: pkg,
557+
Test: testCase.Name,
558+
Output: result.Contents,
559+
Elapsed: elapsed,
560+
}
545561
}
546562
failures[key] = append(failures[key], event)
547563
}

pkg/cmd/bazci/githubpost/githubpost_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,15 @@ func TestListFailuresFromTestXML(t *testing.T) {
408408
mention: []string{"@cockroachdb/unowned"},
409409
}},
410410
},
411+
{
412+
fileName: "test-error-142.xml", // #159708 case
413+
expPkg: "pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test",
414+
expIssues: []issue{{
415+
testName: "pkg",
416+
title: "pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test: pkg failed",
417+
message: `Test binary potentially failed to execute because of bazel test timeout, init() issue, or some other error.`,
418+
}},
419+
},
411420
}
412421

413422
for _, c := range testCases {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<testsuites>
2+
<testsuite errors="1" failures="0" skipped="0" tests="1" time="0"
3+
name="pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test" timestamp="">
4+
<testcase name="pkg/sql/opt/testutils/testcat/testcat_test_/testcat_test" time="60">
5+
<error message="exited with error code 142" />
6+
</testcase>
7+
</testsuite>
8+
</testsuites>

0 commit comments

Comments
 (0)