From db3831a2facbedbe447e00f600e4f1697de11882 Mon Sep 17 00:00:00 2001 From: Ricky Stewart Date: Wed, 5 Nov 2025 14:49:06 -0600 Subject: [PATCH] bazci/githubpost: fix `pkg` calculation from `test.xml` Since the `rules_go` upgrade from #156000, we have accidentally included the test name in the package path. This PR fixes that and fixes the associated test case. Release note: none Epic: none --- pkg/cmd/bazci/githubpost/githubpost.go | 4 ++ pkg/cmd/bazci/githubpost/githubpost_test.go | 9 ++- pkg/cmd/bazci/githubpost/testdata/basic.xml | 79 ++++++++++++++++----- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/pkg/cmd/bazci/githubpost/githubpost.go b/pkg/cmd/bazci/githubpost/githubpost.go index 5edd98bfbe7e..7e19e32e0cfb 100644 --- a/pkg/cmd/bazci/githubpost/githubpost.go +++ b/pkg/cmd/bazci/githubpost/githubpost.go @@ -516,6 +516,10 @@ func listFailuresFromTestXML( failures := make(map[scopedTest][]testEvent) for _, suite := range suites.Suites { pkg := suite.Name + dotIdx := strings.LastIndexByte(pkg, '.') + if dotIdx > 0 { + pkg = pkg[:dotIdx] + } for _, testCase := range suite.TestCases { var result *buildutil.XMLMessage if testCase.Failure != nil { diff --git a/pkg/cmd/bazci/githubpost/githubpost_test.go b/pkg/cmd/bazci/githubpost/githubpost_test.go index f0a08d7783d4..63aec55ee7bb 100644 --- a/pkg/cmd/bazci/githubpost/githubpost_test.go +++ b/pkg/cmd/bazci/githubpost/githubpost_test.go @@ -421,9 +421,12 @@ func TestListFailuresFromTestXML(t *testing.T) { title: "util/json: TestJSONErrors failed", message: `=== RUN TestJSONErrors --- FAIL: TestJSONErrors (0.00s) -=== RUN TestJSONErrors/frues - json_test.go:278: expected error message to be 'trailing characters after JSON document', but was 'unable to decode JSON: invalid character 'r' in literal false (expecting 'a')' - --- FAIL: TestJSONErrors/frues (0.00s)`, +=== RUN TestJSONErrors/gostd/frues + json_test.go:404: + Error Trace: pkg/util/json/json_test.go:404 + Error: Expect "unable to decode JSON: invalid character 'r' in literal false (expecting 'a')" to match "trailing characters after JSON document" + Test: TestJSONErrors/gostd/frues +--- FAIL: TestJSONErrors/gostd/frues (0.00s)`, mention: []string{"@cockroachdb/unowned"}, }}, }, diff --git a/pkg/cmd/bazci/githubpost/testdata/basic.xml b/pkg/cmd/bazci/githubpost/testdata/basic.xml index 9c5dcd7355bd..b7ad5b2daa42 100644 --- a/pkg/cmd/bazci/githubpost/testdata/basic.xml +++ b/pkg/cmd/bazci/githubpost/testdata/basic.xml @@ -1,25 +1,68 @@ - - - + === RUN TestJSONErrors --- FAIL: TestJSONErrors (0.00s) - - - - - - - - - - === RUN TestJSONErrors/frues json_test.go:278: expected error message to be 'trailing characters after JSON document', but was 'unable to decode JSON: invalid character 'r' in literal false (expecting 'a')' --- FAIL: TestJSONErrors/frues (0.00s) + + + + + + + + + + + + + + + + + + + + + === RUN TestJSONErrors/gostd/frues json_test.go:404: Error Trace: pkg/util/json/json_test.go:404 Error: Expect "unable to decode JSON: invalid character 'r' in literal false (expecting 'a')" to match "trailing characters after JSON document" Test: TestJSONErrors/gostd/frues --- FAIL: TestJSONErrors/gostd/frues (0.00s) - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +