Skip to content

Commit bafecb5

Browse files
authored
Merge pull request #159827 from williamchoe3/blathers/backport-release-25.3-159751
release-25.3: bazci: improve github issues when test.xml does not contain fully qualified unit test names
2 parents 66644b6 + 2a645da commit bafecb5

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
@@ -543,12 +543,28 @@ func listFailuresFromTestXML(
543543
fmt.Printf("couldn't parse time %s as float64: %+v\n", testCase.Time, err)
544544
}
545545
}
546-
event := testEvent{
547-
Action: "fail",
548-
Package: pkg,
549-
Test: testCase.Name,
550-
Output: result.Contents,
551-
Elapsed: elapsed,
546+
var event testEvent
547+
if pkg == testCase.Name {
548+
// Test case or suite name is potentially irregular and does not
549+
// match the expected format. Test binary may not have successfully
550+
// executed or encountered some other error. We will make a special
551+
// testEvent for this case.
552+
// See unit tests for an example. See #159708 for more details.
553+
log.Printf("encountered xml with non fully qualified test failure(s) %s and test suite(s) %s", pkg, testCase.Name)
554+
event = testEvent{
555+
Package: pkg,
556+
Test: testCase.Name,
557+
Output: fmt.Sprintf("Test binary potentially failed to execute because of bazel test timeout,"+
558+
" init() issue, or some other error. Content: %s", result.Contents),
559+
}
560+
} else {
561+
event = testEvent{
562+
Action: "fail",
563+
Package: pkg,
564+
Test: testCase.Name,
565+
Output: result.Contents,
566+
Elapsed: elapsed,
567+
}
552568
}
553569
failures[key] = append(failures[key], event)
554570
}

pkg/cmd/bazci/githubpost/githubpost_test.go

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

412421
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)