prune-junit-xml: smarter concatenation when pruning tests

Repeating the same "Failed" message text doesn't add any
information. Separating with a blank line is more readable.

Before:

    <failure message="Failed; Failed; Failed" type="">
       ...
       --- FAIL: TestFrontProxyConfig/WithoutUID (64.89s) ; === RUN TestFrontProxyConfig/WithUID

After:

    <failure message="Failed" type="">
       ...
       --- FAIL: TestFrontProxyConfig/WithoutUID (64.89s)

       === RUN TestFrontProxyConfig/WithUID
This commit is contained in:
Patrick Ohly
2024-12-02 09:29:11 +01:00
parent 95d71c464a
commit e0e4af8a58
2 changed files with 39 additions and 3 deletions

View File

@@ -108,6 +108,20 @@ func TestPruneTESTS(t *testing.T) {
<failure message="FailedB" type="">FailureContentB</failure>
</testcase>
</testsuite>
<testsuite tests="3" failures="3" time="40.050000" name="k8s.io/kubernetes/test/integration/apimachinery3" timestamp="">
<properties>
<property name="go.version" value="go1.18 linux/amd64"></property>
</properties>
<testcase classname="k8s.io/kubernetes/test/integration/apimachinery3" name="TestWatchRestartsIfTimeoutNotReached/group/InformerWatcher_survives_closed_watches" time="40.050000">
<failure message="Failed" type="">RUNNING TestWatchRestartsIfTimeoutNotReached/group/InformerWatcher_survives_closed_watchesA&#xA;expected foo, got bar</failure>
</testcase>
<testcase classname="k8s.io/kubernetes/test/integration/apimachinery3" name="TestWatchRestartsIfTimeoutNotReached/group" time="40.050000">
<failure message="Failed" type="">sub-test failed</failure>
</testcase>
<testcase classname="k8s.io/kubernetes/test/integration/apimachinery3" name="TestWatchRestartsIfTimeoutNotReached" time="40.050000">
<failure message="Failed" type="">sub-test failed</failure>
</testcase>
</testsuite>
</testsuites>`
outputXML := `<?xml version="1.0" encoding="UTF-8"?>
@@ -131,7 +145,15 @@ func TestPruneTESTS(t *testing.T) {
<property name="go.version" value="go1.18 linux/amd64"></property>
</properties>
<testcase classname="k8s.io/kubernetes/test/integration" name="apimachinery2" time="30.050000">
<failure message="FailedA; FailedB" type="">FailureContentA; FailureContentB</failure>
<failure message="FailedA&#xA;&#xA;FailedB" type="">FailureContentA&#xA;&#xA;FailureContentB</failure>
</testcase>
</testsuite>
<testsuite tests="3" failures="3" time="40.050000" name="k8s.io/kubernetes/test/integration/apimachinery3" timestamp="">
<properties>
<property name="go.version" value="go1.18 linux/amd64"></property>
</properties>
<testcase classname="k8s.io/kubernetes/test/integration" name="apimachinery3" time="40.050000">
<failure message="Failed" type="">RUNNING TestWatchRestartsIfTimeoutNotReached/group/InformerWatcher_survives_closed_watchesA&#xA;expected foo, got bar&#xA;&#xA;sub-test failed</failure>
</testcase>
</testsuite>
</testsuites>`