From 9ff8bdbd2597fb36eecc93a136329ae47b690747 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 2 Aug 2022 13:58:51 +0200 Subject: [PATCH] ginkgo: disable color escape sequences by default when not connected to a terminal This applies to all jobs using hack/ginkgo-e2e.sh. This is done because Spyglass does not render the escape sequences, making test output harder to read. It is done here because then we don't need to set GINKGO_NO_COLOR in all the different Prow job configs. --- hack/ginkgo-e2e.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index ffb2a47dd46..604a10e08d3 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -34,9 +34,12 @@ e2e_test=$(kube::util::find-binary "e2e.test") GINKGO_PARALLEL=${GINKGO_PARALLEL:-n} # set to 'y' to run tests in parallel CLOUD_CONFIG=${CLOUD_CONFIG:-""} -# If 'y', Ginkgo's reporter will not print out in color when tests are run -# in parallel -GINKGO_NO_COLOR=${GINKGO_NO_COLOR:-n} +# If 'y', Ginkgo's reporter will not use escape sequence to color output. +# +# Since Kubernetes 1.25, the default is to use colors only when connected to +# a terminal. That is the right choice for all Prow jobs (Spyglass doesn't +# render them properly). +GINKGO_NO_COLOR=${GINKGO_NO_COLOR:-$(if [ -t 2 ]; then echo n; else echo y; fi)} # If 'y', will rerun failed tests once to give them a second chance. GINKGO_TOLERATE_FLAKES=${GINKGO_TOLERATE_FLAKES:-n} @@ -148,7 +151,7 @@ if [[ "${GINKGO_TOLERATE_FLAKES}" == "y" ]]; then fi if [[ "${GINKGO_NO_COLOR}" == "y" ]]; then - ginkgo_args+=("--noColor") + ginkgo_args+=("--no-color") fi # The --host setting is used only when providing --auth_config