Files
tasks/tools/testrunner/testdata/junit-iteration-suffix.xml
MoeandGitHub 2d693e2ee9 fix: testrunner discarding tests with iteration suffixes (#9192)
## What changed?

Changed the parent test detection logic in `mergeReports` from
`HasPrefix(next, current)` to `HasPrefix(next, current+"/")`.

## Why?

Tests with `#XX` iteration suffixes (e.g., `TestFoo#01`) were
incorrectly treated as children of the base test (`TestFoo`), causing
the base test's `<failure>` element to be discarded during JUnit report
merging.

For example, `TestDatanodeSuite/TestLineageFork` was being discarded
because `TestDatanodeSuite/TestLineageFork#01` matched the prefix check.
This caused failure details to be lost in the merged JUnit XML output,
breaking flaky test reporting in CI.

The fix ensures only actual subtests (with `/` separator) trigger parent
discarding, not iteration suffixes.

## How did you test it?

- [x] built
- [x] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2026-02-02 09:55:39 -08:00

22 lines
1.3 KiB
XML

<testsuites time="5.000000" tests="4" failures="2">
<testsuite name="github.com/example/tests" tests="4" failures="2" errors="0" id="0" time="5.000000" timestamp="2024-11-18T14:05:44-08:00">
<properties>
<property name="go.version" value="go1.23.2 darwin/arm64"></property>
</properties>
<testcase name="TestDatanodeSuite/TestLineageFork" classname="github.com/example/tests" time="0.100000">
<failure message="Failed"><![CDATA[=== RUN TestDatanodeSuite/TestLineageFork
datanode_test.go:99: Intentional failure
--- FAIL: TestDatanodeSuite/TestLineageFork (0.10s)
]]></failure>
</testcase>
<testcase name="TestDatanodeSuite/TestLineageFork#01" classname="github.com/example/tests" time="0.200000">
<failure message="Failed"><![CDATA[=== RUN TestDatanodeSuite/TestLineageFork#01
datanode_test.go:99: Intentional failure iteration 1
--- FAIL: TestDatanodeSuite/TestLineageFork#01 (0.20s)
]]></failure>
</testcase>
<testcase name="TestDatanodeSuite/TestLineageFork#02" classname="github.com/example/tests" time="0.300000"></testcase>
<testcase name="TestDatanodeSuite/TestOtherTest" classname="github.com/example/tests" time="0.400000"></testcase>
</testsuite>
</testsuites>