This is an automated email from the ASF dual-hosted git repository.
elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 13fe31b HDDS-4167. Acceptance test logs missing if fails during
cluster startup (#1366)
13fe31b is described below
commit 13fe31b4927660bc2534656c6a7048b45d3c8051
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Tue Sep 1 16:39:51 2020 +0200
HDDS-4167. Acceptance test logs missing if fails during cluster startup
(#1366)
---
.../dist/src/main/compose/ozone-mr/test.sh | 22 +++++--------
hadoop-ozone/dist/src/main/compose/test-all.sh | 21 +++----------
hadoop-ozone/dist/src/main/compose/testlib.sh | 36 ++++++++++++++++++++++
3 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
b/hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
index 6146dab..3a18d4d 100644
--- a/hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -15,29 +16,22 @@
# limitations under the License.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )
ALL_RESULT_DIR="$SCRIPT_DIR/result"
+mkdir -p "$ALL_RESULT_DIR"
+rm "$ALL_RESULT_DIR/*" || true
source "$SCRIPT_DIR/../testlib.sh"
tests=$(find_tests)
+cd "$SCRIPT_DIR"
RESULT=0
# shellcheck disable=SC2044
for t in ${tests}; do
d="$(dirname "${t}")"
- echo "Executing test in ${d}"
- #required to read the .env file from the right location
- cd "${d}" || continue
- ./test.sh
- ret=$?
- if [[ $ret -ne 0 ]]; then
- RESULT=1
- echo "ERROR: Test execution of ${d} is FAILED!!!!"
+ if ! run_test_script "${d}"; then
+ RESULT=1
fi
- cd "$SCRIPT_DIR"
- RESULT_DIR="${d}/result"
- TEST_DIR_NAME=$(basename ${d})
- rebot -N $TEST_DIR_NAME -o "$ALL_RESULT_DIR"/$TEST_DIR_NAME.xml
"$RESULT_DIR"/"*.xml"
- cp "$RESULT_DIR"/docker-*.log "$ALL_RESULT_DIR"/
- cp "$RESULT_DIR"/*.out* "$ALL_RESULT_DIR"/ || true
+
+ copy_results "${d}" "${ALL_RESULT_DIR}"
done
diff --git a/hadoop-ozone/dist/src/main/compose/test-all.sh
b/hadoop-ozone/dist/src/main/compose/test-all.sh
index 1fdc0ff..45a3c52 100755
--- a/hadoop-ozone/dist/src/main/compose/test-all.sh
+++ b/hadoop-ozone/dist/src/main/compose/test-all.sh
@@ -34,29 +34,18 @@ if [ "$OZONE_WITH_COVERAGE" ]; then
fi
tests=$(find_tests)
+cd "$SCRIPT_DIR"
RESULT=0
# shellcheck disable=SC2044
for t in ${tests}; do
d="$(dirname "${t}")"
- echo "Executing test in ${d}"
- #required to read the .env file from the right location
- cd "${d}" || continue
- set +e
- ./test.sh
- ret=$?
- set -e
- if [[ $ret -ne 0 ]]; then
- RESULT=1
- echo "ERROR: Test execution of ${d} is FAILED!!!!"
+ if ! run_test_script "${d}"; then
+ RESULT=1
fi
- cd "$SCRIPT_DIR"
- RESULT_DIR="${d}/result"
- TEST_DIR_NAME=$(basename ${d})
- rebot --nostatusrc -N $TEST_DIR_NAME -o "$ALL_RESULT_DIR"/$TEST_DIR_NAME.xml
"$RESULT_DIR"/"*.xml"
- cp "$RESULT_DIR"/docker-*.log "$ALL_RESULT_DIR"/
- cp "$RESULT_DIR"/*.out* "$ALL_RESULT_DIR"/ || true
+
+ copy_results "${d}" "${ALL_RESULT_DIR}"
done
rebot --nostatusrc -N acceptance -d "$ALL_RESULT_DIR" "$ALL_RESULT_DIR"/*.xml
diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh
b/hadoop-ozone/dist/src/main/compose/testlib.sh
index 228572f..db449b9 100755
--- a/hadoop-ozone/dist/src/main/compose/testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/testlib.sh
@@ -247,3 +247,39 @@ generate_report(){
exit 1
fi
}
+
+## @description Copy results of a single test environment to the "all tests"
dir.
+copy_results() {
+ local test_dir="$1"
+ local all_result_dir="$2"
+
+ local result_dir="${test_dir}/result"
+ local test_dir_name=$(basename ${test_dir})
+ if [[ -n "$(find "${result_dir}" -name "*.xml")" ]]; then
+ rebot --nostatusrc -N "${test_dir_name}" -o
"${all_result_dir}/${test_dir_name}.xml" "${result_dir}/*.xml"
+ fi
+
+ cp "${result_dir}"/docker-*.log "${all_result_dir}"/
+ if [[ -n "$(find "${result_dir}" -name "*.out")" ]]; then
+ cp "${result_dir}"/*.out* "${all_result_dir}"/
+ fi
+}
+
+run_test_script() {
+ local d="$1"
+
+ echo "Executing test in ${d}"
+
+ #required to read the .env file from the right location
+ cd "${d}" || return
+
+ ret=0
+ if ! ./test.sh; then
+ ret=1
+ echo "ERROR: Test execution of ${d} is FAILED!!!!"
+ fi
+
+ cd - > /dev/null
+
+ return ${ret}
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]