e2e: dump full report information

The Ginkgo CLI output no longer has the full output. We need the reports
generated by Ginkgo for that.
This commit is contained in:
Patrick Ohly 2022-11-02 14:00:38 +01:00
parent 460f796bb7
commit 6db4b741dd
2 changed files with 27 additions and 2 deletions

View File

@ -163,6 +163,18 @@ if [[ "${GINKGO_NO_COLOR}" == "y" ]]; then
ginkgo_args+=("--no-color")
fi
if [[ -n "${E2E_REPORT_DIR:-}" ]]; then
report_dir="${E2E_REPORT_DIR}"
else
# Some jobs don't use E2E_REPORT_DIR and instead pass --report-dir=<dir>
# as parameter.
for arg in "${@}"; do
# shellcheck disable=SC2001
# (style): See if you can use ${variable//search/replace} instead.
case "$arg" in -report-dir=*|--report-dir=*) report_dir="$(echo "$arg" | sed -e 's/^[^=]*=//')";; esac
done
fi
# The --host setting is used only when providing --auth_config
# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
# file and the one provided with --host is ignored.
@ -183,6 +195,19 @@ case "${E2E_TEST_DEBUG_TOOL:-ginkgo}" in
program+=("--nodes=25")
fi
program+=("${ginkgo_args[@]:+${ginkgo_args[@]}}")
if [[ -n "${report_dir:-}" ]]; then
# The JUnit report written by the E2E suite gets truncated to avoid
# overwhelming the tools that need to process it. For manual analysis
# it is useful to have the full reports in both formats that Ginkgo
# supports:
# - JUnit for comparison with the truncated report.
# - JSON because it is a faithful representation of
# all available information.
#
# This has to be passed to the CLI, the suite doesn't support --output-dir.
program+=("--output-dir=${report_dir}" "--junit-report=ginkgo_report.xml" "--json-report=ginkgo_report.json")
fi
;;
delve) program=("dlv" "exec") ;;
gdb) program=("gdb") ;;

View File

@ -549,8 +549,8 @@ func writeJUnitReport(report ginkgo.Report) {
trimmedReport.SpecReports = nil
for _, specReport := range report.SpecReports {
// Remove details for any spec that hasn't failed. In Prow,
// the test output captured in build-log.txt has all of this
// information, so we don't need it in the XML.
// 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 = ""