diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 1dee6be4a67..9e0ead5b20d 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -530,14 +530,6 @@ func AfterReadingAllFlags(t *TestContextType) { } } -const ( - // This is the traditional gomega.Format default of 4000 for an object - // dump plus some extra room for the message. - maxFailureMessageSize = 5000 - - truncatedMsg = "\n[... see output for full dump ...]\n" -) - // writeJUnitReport generates a JUnit file in the e2e report directory that is // shorter than the one normally written by `ginkgo --junit-report`. This is // needed because the full report can become too large for tools like Spyglass @@ -545,47 +537,15 @@ const ( // // Users who want the full report can use `--junit-report`. func writeJUnitReport(report ginkgo.Report) { - trimmedReport := report - trimmedReport.SpecReports = nil - for _, specReport := range report.SpecReports { - // Remove details for any spec that hasn't failed. In Prow, - // jobs that use ginkgo-e2e.sh will dump the full - // information into ginkgo_report.xml/json. - if specReport.State != types.SpecStateFailed { - specReport.CapturedGinkgoWriterOutput = "" - specReport.CapturedStdOutErr = "" - } else { - // Truncate the failure message if it is too large. - msgLen := len(specReport.Failure.Message) - if msgLen > maxFailureMessageSize { - // Insert full message at the beginning where it is easy to find. - specReport.CapturedGinkgoWriterOutput = - "Full failure message:\n" + - specReport.Failure.Message + "\n\n" + - strings.Repeat("=", 70) + "\n\n" + - specReport.CapturedGinkgoWriterOutput - specReport.Failure.Message = specReport.Failure.Message[0:maxFailureMessageSize/2] + truncatedMsg + specReport.Failure.Message[msgLen-maxFailureMessageSize/2:msgLen] - } - } + config := reporters.JunitReportConfig{ + // Remove details for specs where we don't care. + OmitTimelinesForSpecState: types.SpecStatePassed | types.SpecStateSkipped, - // Remove report entries generated by ginkgo.By("doing - // something") because those are not useful (just have the - // start time) and cause Spyglass to show an additional "open - // stdout" button with a summary of the steps, which usually - // doesn't help. We don't remove all entries because other - // measurements also get reported this way. - // - // Removing the report entries is okay because message text was - // already added to the test output when ginkgo.By was called. - reportEntries := specReport.ReportEntries - specReport.ReportEntries = nil - for _, reportEntry := range reportEntries { - if reportEntry.Name != "By Step" { - specReport.ReportEntries = append(specReport.ReportEntries, reportEntry) - } - } - - trimmedReport.SpecReports = append(trimmedReport.SpecReports, specReport) + // Don't write . The same text is + // also in the full text for the failure. If we were to write + // both, then tools like kettle and spyglass would concatenate + // the two strings and thus show duplicated information. + OmitFailureMessageAttr: true, } // With Ginkgo v1, we used to write one file per parallel node. Now @@ -593,5 +553,5 @@ func writeJUnitReport(report ginkgo.Report) { // 01 suffix is kept in case that users expect files to be called // "junit_.xml". junitReport := path.Join(TestContext.ReportDir, "junit_"+TestContext.ReportPrefix+"01.xml") - reporters.GenerateJUnitReport(trimmedReport, junitReport) + reporters.GenerateJUnitReportWithConfig(report, junitReport, config) }