From 9a3a051d1c2cb192f60a75a5a483e55d62a0f864 Mon Sep 17 00:00:00 2001 From: John Schnake Date: Mon, 21 Oct 2019 15:15:23 -0500 Subject: [PATCH] Ensure script saves results even when tests fail When we run commands that may exit non-zero during normal operation we need to ensure the script does not exit early and avoid saving the results. Signed-off-by: John Schnake --- cluster/images/conformance/run_e2e.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cluster/images/conformance/run_e2e.sh b/cluster/images/conformance/run_e2e.sh index 6301b7fc270..b60c98d9d2c 100755 --- a/cluster/images/conformance/run_e2e.sh +++ b/cluster/images/conformance/run_e2e.sh @@ -40,8 +40,8 @@ saveResults() { # Entry provided via env var to simplify invocation. if [[ -n ${E2E_USE_GO_RUNNER:-} ]]; then set -x - /gorunner - exit $? + /gorunner && ret=0 || ret=$? + exit ${ret} fi # We get the TERM from kubernetes and handle it gracefully @@ -67,8 +67,7 @@ ginkgo_args+=( ) set -x -/usr/local/bin/ginkgo "${ginkgo_args[@]}" /usr/local/bin/e2e.test -- --disable-log-dump --repo-root=/kubernetes --provider="${E2E_PROVIDER}" --report-dir="${RESULTS_DIR}" --kubeconfig="${KUBECONFIG}" -v="${E2E_VERBOSITY}" > >(tee "${RESULTS_DIR}"/e2e.log) -ret=$? +/usr/local/bin/ginkgo "${ginkgo_args[@]}" /usr/local/bin/e2e.test -- --disable-log-dump --repo-root=/kubernetes --provider="${E2E_PROVIDER}" --report-dir="${RESULTS_DIR}" --kubeconfig="${KUBECONFIG}" -v="${E2E_VERBOSITY}" > >(tee "${RESULTS_DIR}"/e2e.log) && ret=0 || ret=$? set +x saveResults exit ${ret}