From 908497348c3c72b37c9bb6bbaaefa9437decb69c Mon Sep 17 00:00:00 2001 From: David Heryanto Date: Wed, 29 May 2019 11:38:43 +0800 Subject: [PATCH 1/3] Fix unit test not returning correct exit code Previously, after piping and calling tee, the return code is the return code of tee not the test command, which is not what we want --- .prow/scripts/run_unit_test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.prow/scripts/run_unit_test.sh b/.prow/scripts/run_unit_test.sh index f36fa58f90..07ab3a137c 100755 --- a/.prow/scripts/run_unit_test.sh +++ b/.prow/scripts/run_unit_test.sh @@ -37,6 +37,9 @@ if [[ ${COMPONENT} == "core" ]] || [[ ${COMPONENT} == "ingestion" ]] || [[ ${COM elif [[ ${COMPONENT} == "cli" ]]; then + # https://stackoverflow.com/questions/6871859/piping-command-output-to-tee-but-also-save-exit-code-of-command + set -o pipefail + go get -u github.com/jstemmer/go-junit-report go test -v ./cli/feast/... 2>&1 | tee test_output TEST_EXIT_CODE=$? From ecda1baf56c28960b4e1b45c5e8efa906c8bf19b Mon Sep 17 00:00:00 2001 From: David Heryanto Date: Wed, 29 May 2019 13:33:30 +0800 Subject: [PATCH 2/3] Remove set -e to ensure test report is written --- .prow/scripts/run_unit_test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.prow/scripts/run_unit_test.sh b/.prow/scripts/run_unit_test.sh index 07ab3a137c..6d8ff77de8 100755 --- a/.prow/scripts/run_unit_test.sh +++ b/.prow/scripts/run_unit_test.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -set -e # This script will run unit test for a specific Feast component: # - core, ingestion, serving or cli From f9453555cfd938ef168c8c97142801d12fb15375 Mon Sep 17 00:00:00 2001 From: David Heryanto Date: Wed, 29 May 2019 13:54:36 +0800 Subject: [PATCH 3/3] Restore bash option after running install_google_cloud_sdk.sh --- .prow/scripts/install_google_cloud_sdk.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.prow/scripts/install_google_cloud_sdk.sh b/.prow/scripts/install_google_cloud_sdk.sh index 18fb96834f..0865f6085c 100755 --- a/.prow/scripts/install_google_cloud_sdk.sh +++ b/.prow/scripts/install_google_cloud_sdk.sh @@ -39,3 +39,6 @@ if [[ ${KEY_FILE} ]]; then gcloud -q container clusters get-credentials ${KUBE_CLUSTER_NAME} --zone ${KUBE_CLUSTER_ZONE} --project ${GOOGLE_PROJECT_ID} export GOOGLE_APPLICATION_CREDENTIALS=${KEY_FILE} fi + +# Restore bash option +set +e \ No newline at end of file