From 99fd5fcbb55cfed6d5d6b90420f44fcf4068a28d Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" <6454655+adoroszlai@users.noreply.github.com> Date: Fri, 3 Jan 2025 13:51:22 +0100 Subject: [PATCH] HDDS-11801. Logs missing if kubernetes check fails before tests (#7496) --- .../dist/src/main/k8s/examples/test-all.sh | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh b/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh index 5d866514be9..6f72fc7e6cc 100755 --- a/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh +++ b/hadoop-ozone/dist/src/main/k8s/examples/test-all.sh @@ -15,14 +15,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -u -o pipefail # -# Test executor to test all the compose/*/test.sh test scripts. +# Test executor to test all the k8s/examples/*/test.sh test scripts. # SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd ) -set -ex - ALL_RESULT_DIR="$SCRIPT_DIR/result" rm "$ALL_RESULT_DIR"/* || true mkdir -p "$ALL_RESULT_DIR" @@ -35,15 +34,23 @@ for test in $(find "$SCRIPT_DIR" -name test.sh | grep "${OZONE_TEST_SELECTOR:-"" TEST_NAME="$(basename "$TEST_DIR")" echo "" - echo "#### Executing tests of ${TEST_DIR} #####" + echo "#### Executing tests of ${TEST_NAME} #####" echo "" cd "$TEST_DIR" || continue - ./test.sh + if ! ./test.sh; then + RESULT=1 + echo "ERROR: Test execution of ${TEST_NAME} is FAILED!!!!" + fi - cp "$TEST_DIR"/result/output.xml "$ALL_RESULT_DIR"/"${TEST_NAME}".xml + cp "$TEST_DIR"/result/output.xml "$ALL_RESULT_DIR"/"${TEST_NAME}".xml || true mkdir -p "$ALL_RESULT_DIR"/"${TEST_NAME}" - mv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/ + mv "$TEST_DIR"/logs/*log "$ALL_RESULT_DIR"/"${TEST_NAME}"/ || true + + if [[ "${RESULT}" == "1" ]] && [[ "${FAIL_FAST:-}" == "true" ]]; then + break + fi done rebot -N "smoketests" -d "$ALL_RESULT_DIR/" "$ALL_RESULT_DIR/*.xml" +exit ${RESULT}