Skip to content

Commit cd8b853

Browse files
stbenjamclaude
andcommitted
Show non-blocking failure message in JUnit failure output
Move the "NON-BLOCKING FAILURE" message from testOutputBytes (which is prepended to the beginning and not visible in the JUnit failure lens since it shows the last ~100 lines) into the JUnit FailureOutput.Output field directly. This ensures informing test failures are clearly marked as non-blocking when viewed in the Spyglass JUnit lens in Prow. Fixes TRT-2573 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0509de9 commit cd8b853

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

pkg/test/ginkgo/cmd_runsuite.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,9 +874,6 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc
874874
if isBlockingFailure(test) {
875875
blockingFailures = append(blockingFailures, test)
876876
} else {
877-
test.testOutputBytes = []byte(fmt.Sprintf("*** NON-BLOCKING FAILURE: This test failure is not considered terminal because its lifecycle is '%s' and will not prevent the overall suite from passing.\n\n%s",
878-
test.extensionTestResult.Lifecycle,
879-
string(test.testOutputBytes)))
880877
informingFailures = append(informingFailures, test)
881878
}
882879
}

pkg/test/ginkgo/junit.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"strings"
1010
"time"
1111

12+
"github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
13+
1214
"github.com/openshift/origin/pkg/test"
1315
"github.com/openshift/origin/pkg/test/extensions"
1416
"github.com/openshift/origin/pkg/test/ginkgo/junitapi"
@@ -78,12 +80,17 @@ func generateJUnitTestSuiteResults(
7880
case test.failed:
7981
s.NumTests++
8082
s.NumFailed++
83+
failureMessage := lastLinesUntil(string(test.testOutputBytes), 100, "fail [")
84+
if test.extensionTestResult != nil && test.extensionTestResult.Lifecycle == extensiontests.LifecycleInforming {
85+
failureMessage = fmt.Sprintf("*** NON-BLOCKING FAILURE: This test failure is not considered terminal because its lifecycle is '%s' and will not prevent the overall suite from passing.\n\n%s",
86+
test.extensionTestResult.Lifecycle, failureMessage)
87+
}
8188
testCase := &junitapi.JUnitTestCase{
8289
Name: test.name,
8390
SystemOut: string(test.testOutputBytes),
8491
Duration: test.duration.Seconds(),
8592
FailureOutput: &junitapi.FailureOutput{
86-
Output: lastLinesUntil(string(test.testOutputBytes), 100, "fail ["),
93+
Output: failureMessage,
8794
},
8895
}
8996
populateOTEMetadata(testCase, test.extensionTestResult)

0 commit comments

Comments
 (0)