You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2020/07/30 04:31:12 UTC
[hadoop-ozone] branch master updated: HDDS-4033. Make the
acceptance test reports hierarchical (#1263)
This is an automated email from the ASF dual-hosted git repository.
adoroszlai 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 5837e86 HDDS-4033. Make the acceptance test reports hierarchical (#1263)
5837e86 is described below
commit 5837e868031623c0fff4e6fdab571b001e93ab3a
Author: Elek, Márton <el...@users.noreply.github.com>
AuthorDate: Thu Jul 30 06:31:03 2020 +0200
HDDS-4033. Make the acceptance test reports hierarchical (#1263)
---
.../dist/src/main/compose/ozone-mr/test.sh | 43 ++++++++++++++++++++++
.../dist/src/main/compose/ozone-topology/test.sh | 4 +-
hadoop-ozone/dist/src/main/compose/ozone/test.sh | 4 +-
.../dist/src/main/compose/ozonesecure/test.sh | 4 +-
hadoop-ozone/dist/src/main/compose/test-all.sh | 30 +++++----------
hadoop-ozone/dist/src/main/compose/testlib.sh | 24 +++++++++++-
.../dist/src/test/shell/compose_testlib.bats | 37 +++++++++++++++++++
hadoop-ozone/dist/src/test/shell/test1/test.sh | 15 ++++++++
hadoop-ozone/dist/src/test/shell/test2/test.sh | 17 +++++++++
.../dist/src/test/shell/test3/subtest1/test.sh | 17 +++++++++
hadoop-ozone/dist/src/test/shell/test4/test.sh | 17 +++++++++
11 files changed, 185 insertions(+), 27 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
new file mode 100644
index 0000000..6146dab
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
@@ -0,0 +1,43 @@
+# 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
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )
+ALL_RESULT_DIR="$SCRIPT_DIR/result"
+source "$SCRIPT_DIR/../testlib.sh"
+
+tests=$(find_tests)
+
+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!!!!"
+ 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
+done
+
diff --git a/hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh b/hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
index d4efa4f..392112b 100755
--- a/hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
@@ -39,7 +39,7 @@ execute_robot_test scm topology/loaddata.robot
stop_containers datanode_1 datanode_2 datanode_3
-execute_robot_test scm topology/readdata.robot
+execute_robot_test scm -N readdata-first-half topology/readdata.robot
start_containers datanode_1 datanode_2 datanode_3
@@ -49,7 +49,7 @@ wait_for_port datanode_3 9858 60
stop_containers datanode_4 datanode_5 datanode_6
-execute_robot_test scm topology/readdata.robot
+execute_robot_test scm -N readdata-second-half topology/readdata.robot
stop_docker_env
diff --git a/hadoop-ozone/dist/src/main/compose/ozone/test.sh b/hadoop-ozone/dist/src/main/compose/ozone/test.sh
index b5b778f..2f57831 100755
--- a/hadoop-ozone/dist/src/main/compose/ozone/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozone/test.sh
@@ -37,14 +37,14 @@ execute_robot_test scm gdpr
for scheme in ofs o3fs; do
for bucket in link bucket; do
- execute_robot_test scm -v SCHEME:${scheme} -v BUCKET_TYPE:${bucket} ozonefs/ozonefs.robot
+ execute_robot_test scm -v SCHEME:${scheme} -v BUCKET_TYPE:${bucket} -N ozonefs-${scheme}-${bucket} ozonefs/ozonefs.robot
done
done
execute_robot_test scm security/ozone-secure-token.robot
for bucket in link generated; do
- execute_robot_test scm -v BUCKET:${bucket} s3
+ execute_robot_test scm -v BUCKET:${bucket} -N s3-${bucket} s3
done
execute_robot_test scm recon
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
index 076b83a..eeccb84 100755
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
@@ -39,12 +39,12 @@ execute_robot_test scm security
for scheme in ofs o3fs; do
for bucket in link bucket; do
- execute_robot_test scm -v SCHEME:${scheme} -v BUCKET_TYPE:${bucket} ozonefs/ozonefs.robot
+ execute_robot_test scm -v SCHEME:${scheme} -v BUCKET_TYPE:${bucket} -N ozonefs-${scheme}-${bucket} ozonefs/ozonefs.robot
done
done
for bucket in link generated; do
- execute_robot_test s3g -v BUCKET:${bucket} s3
+ execute_robot_test s3g -v BUCKET:${bucket} -N s3-${bucket} s3
done
#expects 4 pipelines, should be run before
diff --git a/hadoop-ozone/dist/src/main/compose/test-all.sh b/hadoop-ozone/dist/src/main/compose/test-all.sh
index da3b80e..15e2688 100755
--- a/hadoop-ozone/dist/src/main/compose/test-all.sh
+++ b/hadoop-ozone/dist/src/main/compose/test-all.sh
@@ -25,30 +25,15 @@ PROJECT_DIR="$SCRIPT_DIR/.."
mkdir -p "$ALL_RESULT_DIR"
rm "$ALL_RESULT_DIR/*" || true
+source "$SCRIPT_DIR"/testlib.sh
+
if [ "$OZONE_WITH_COVERAGE" ]; then
java -cp "$PROJECT_DIR"/share/coverage/$(ls "$PROJECT_DIR"/share/coverage | grep test-util):"$PROJECT_DIR"/share/coverage/jacoco-core.jar org.apache.hadoop.test.JacocoServer &
DOCKER_BRIDGE_IP=$(docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}')
export HADOOP_OPTS="-javaagent:share/coverage/jacoco-agent.jar=output=tcpclient,address=$DOCKER_BRIDGE_IP,includes=org.apache.hadoop.ozone.*:org.apache.hadoop.hdds.*:org.apache.hadoop.fs.ozone.*"
fi
-if [[ -n "${OZONE_ACCEPTANCE_SUITE}" ]]; then
- tests=$(find "$SCRIPT_DIR" -name test.sh | xargs grep -l "^#suite:${OZONE_ACCEPTANCE_SUITE}$" | sort)
-
- # 'misc' is default suite, add untagged tests, too
- if [[ "misc" == "${OZONE_ACCEPTANCE_SUITE}" ]]; then
- untagged="$(find "$SCRIPT_DIR" -name test.sh | xargs grep -L "^#suite:")"
- if [[ -n "${untagged}" ]]; then
- tests=$(echo ${tests} ${untagged} | xargs -n1 | sort)
- fi
- fi
-
- if [[ -z "${tests}" ]]; then
- echo "No tests found for suite ${OZONE_ACCEPTANCE_SUITE}"
- exit 1
- fi
-else
- tests=$(find "$SCRIPT_DIR" -name test.sh | grep "${OZONE_TEST_SELECTOR:-""}" | sort)
-fi
+tests=$(find_tests)
RESULT=0
# shellcheck disable=SC2044
@@ -64,11 +49,16 @@ for t in ${tests}; do
RESULT=1
echo "ERROR: Test execution of ${d} is FAILED!!!!"
fi
+ cd "$SCRIPT_DIR"
RESULT_DIR="${d}/result"
- cp "$RESULT_DIR"/robot-*.xml "$RESULT_DIR"/docker-*.log "$RESULT_DIR"/*.out* "$ALL_RESULT_DIR"/
+ 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
done
-rebot -N "smoketests" -d "$SCRIPT_DIR/result" "$SCRIPT_DIR/result/robot-*.xml"
+rebot -N acceptance -d "$ALL_RESULT_DIR" "$ALL_RESULT_DIR"/*.xml
+
if [ "$OZONE_WITH_COVERAGE" ]; then
pkill -f JacocoServer
cp /tmp/jacoco-combined.exec "$SCRIPT_DIR"/result
diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh b/hadoop-ozone/dist/src/main/compose/testlib.sh
index 5a05633..b000c91 100755
--- a/hadoop-ozone/dist/src/main/compose/testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/testlib.sh
@@ -37,6 +37,28 @@ create_results_dir() {
chmod ogu+w "$RESULT_DIR"
}
+## @description find all the test.sh scripts in the immediate child dirs
+find_tests(){
+ if [[ -n "${OZONE_ACCEPTANCE_SUITE}" ]]; then
+ tests=$(find . -mindepth 2 -maxdepth 2 -name test.sh | xargs grep -l "^#suite:${OZONE_ACCEPTANCE_SUITE}$" | sort)
+
+ # 'misc' is default suite, add untagged tests, too
+ if [[ "misc" == "${OZONE_ACCEPTANCE_SUITE}" ]]; then
+ untagged="$(find . -mindepth 2 -maxdepth 2 -name test.sh | xargs grep -L "^#suite:")"
+ if [[ -n "${untagged}" ]]; then
+ tests=$(echo ${tests} ${untagged} | xargs -n1 | sort)
+ fi
+ fi
+
+ if [[ -z "${tests}" ]]; then
+ echo "No tests found for suite ${OZONE_ACCEPTANCE_SUITE}"
+ exit 1
+ fi
+ else
+ tests=$(find . -mindepth 2 -maxdepth 2 -name test.sh | grep "${OZONE_TEST_SELECTOR:-""}" | sort)
+ fi
+ echo $tests
+}
## @description wait until safemode exit (or 180 seconds)
wait_for_safemode_exit(){
@@ -114,7 +136,7 @@ execute_robot_test(){
OUTPUT_PATH="$RESULT_DIR_INSIDE/${OUTPUT_FILE}"
# shellcheck disable=SC2068
docker-compose exec -T "$CONTAINER" mkdir -p "$RESULT_DIR_INSIDE" \
- && docker-compose exec -T "$CONTAINER" robot -v OM_SERVICE_ID:"${OM_SERVICE_ID}" -v SECURITY_ENABLED:"${SECURITY_ENABLED}" -v OM_HA_PARAM:"${OM_HA_PARAM}" -v KEY_NAME:"${OZONE_BUCKET_KEY_NAME}" ${ARGUMENTS[@]} --log NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST"
+ && docker-compose exec -T "$CONTAINER" robot -v OM_SERVICE_ID:"${OM_SERVICE_ID}" -v SECURITY_ENABLED:"${SECURITY_ENABLED}" -v OM_HA_PARAM:"${OM_HA_PARAM}" -v KEY_NAME:"${OZONE_BUCKET_KEY_NAME}" ${ARGUMENTS[@]} --log NONE --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST"
local -i rc=$?
FULL_CONTAINER_NAME=$(docker-compose ps | grep "_${CONTAINER}_" | head -n 1 | awk '{print $1}')
diff --git a/hadoop-ozone/dist/src/test/shell/compose_testlib.bats b/hadoop-ozone/dist/src/test/shell/compose_testlib.bats
new file mode 100644
index 0000000..058da64
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/compose_testlib.bats
@@ -0,0 +1,37 @@
+#!/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 regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+load ../../main/compose/testlib.sh
+@test "Find test recursive, only on one level" {
+ cd $BATS_TEST_DIRNAME
+ run find_tests
+ [[ "$output" == "./test1/test.sh ./test2/test.sh ./test4/test.sh" ]]
+}
+
+@test "Find test by suite" {
+ OZONE_ACCEPTANCE_SUITE=one
+ cd $BATS_TEST_DIRNAME
+ run find_tests
+ [[ "$output" == "./test4/test.sh" ]]
+}
+
+@test "Find test default suite" {
+ OZONE_ACCEPTANCE_SUITE=misc
+ cd $BATS_TEST_DIRNAME
+ run find_tests
+ [[ "$output" == "./test1/test.sh ./test2/test.sh" ]]
+}
diff --git a/hadoop-ozone/dist/src/test/shell/test1/test.sh b/hadoop-ozone/dist/src/test/shell/test1/test.sh
new file mode 100644
index 0000000..b13ca90
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/test1/test.sh
@@ -0,0 +1,15 @@
+#!/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 regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test2/test.sh b/hadoop-ozone/dist/src/test/shell/test2/test.sh
new file mode 100644
index 0000000..8dbf5b2
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/test2/test.sh
@@ -0,0 +1,17 @@
+#!/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 regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#suite:misc
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh b/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh
new file mode 100644
index 0000000..8dbf5b2
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh
@@ -0,0 +1,17 @@
+#!/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 regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#suite:misc
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test4/test.sh b/hadoop-ozone/dist/src/test/shell/test4/test.sh
new file mode 100644
index 0000000..accc445
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/test4/test.sh
@@ -0,0 +1,17 @@
+#!/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 regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#suite:one
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org