From cd8b8539ee3e87f4989f42e3ffe76d8ff538fa98 Mon Sep 17 00:00:00 2001 From: Stephen Benjamin Date: Mon, 23 Mar 2026 10:42:55 -0400 Subject: [PATCH] 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 --- pkg/test/ginkgo/cmd_runsuite.go | 3 --- pkg/test/ginkgo/junit.go | 9 ++++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/test/ginkgo/cmd_runsuite.go b/pkg/test/ginkgo/cmd_runsuite.go index 92661cd89f52..7d011e9c725e 100644 --- a/pkg/test/ginkgo/cmd_runsuite.go +++ b/pkg/test/ginkgo/cmd_runsuite.go @@ -874,9 +874,6 @@ func (o *GinkgoRunSuiteOptions) Run(suite *TestSuite, clusterConfig *clusterdisc if isBlockingFailure(test) { blockingFailures = append(blockingFailures, test) } else { - 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", - test.extensionTestResult.Lifecycle, - string(test.testOutputBytes))) informingFailures = append(informingFailures, test) } } diff --git a/pkg/test/ginkgo/junit.go b/pkg/test/ginkgo/junit.go index 1e2074ab056c..e65241ff455f 100644 --- a/pkg/test/ginkgo/junit.go +++ b/pkg/test/ginkgo/junit.go @@ -9,6 +9,8 @@ import ( "strings" "time" + "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests" + "github.com/openshift/origin/pkg/test" "github.com/openshift/origin/pkg/test/extensions" "github.com/openshift/origin/pkg/test/ginkgo/junitapi" @@ -78,12 +80,17 @@ func generateJUnitTestSuiteResults( case test.failed: s.NumTests++ s.NumFailed++ + failureMessage := lastLinesUntil(string(test.testOutputBytes), 100, "fail [") + if test.extensionTestResult != nil && test.extensionTestResult.Lifecycle == extensiontests.LifecycleInforming { + 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", + test.extensionTestResult.Lifecycle, failureMessage) + } testCase := &junitapi.JUnitTestCase{ Name: test.name, SystemOut: string(test.testOutputBytes), Duration: test.duration.Seconds(), FailureOutput: &junitapi.FailureOutput{ - Output: lastLinesUntil(string(test.testOutputBytes), 100, "fail ["), + Output: failureMessage, }, } populateOTEMetadata(testCase, test.extensionTestResult)