Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3237856
advanced reporting
elek Jul 17, 2020
ef725df
execute only acceptance
elek Jul 17, 2020
becba2a
avoid recursion
elek Jul 17, 2020
0a5cd41
fix naming
elek Jul 18, 2020
798f9be
retrigger ci
elek Jul 20, 2020
4721b0f
fix test execution
elek Jul 20, 2020
1252d3d
report output
elek Jul 21, 2020
28445cb
do not fail if logs output files are missing
elek Jul 22, 2020
ae58789
fix names in loops
elek Jul 26, 2020
e7ee7c3
Merge remote-tracking branch 'origin/master' into acceptance-reporting
elek Jul 26, 2020
4cdaf4e
follow latest changes from master (dirname /home/elek/projects/ozone-…
elek Jul 26, 2020
51f78ff
re-enable all the tests
elek Jul 27, 2020
378b92a
Merge remote-tracking branch 'origi/master' into HDDS-4033
elek Jul 29, 2020
7d7d84c
address code review comments (+reorganize find_tests)
elek Jul 29, 2020
f7398d4
rat fix
elek Jul 29, 2020
62c9780
Update hadoop-ozone/dist/src/test/shell/compose_testlib.bats
elek Jul 29, 2020
c549d46
Update hadoop-ozone/dist/src/test/shell/compose_testlib.bats
elek Jul 29, 2020
1d003b8
Update hadoop-ozone/dist/src/test/shell/compose_testlib.bats
elek Jul 29, 2020
88f3765
Update hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
elek Jul 29, 2020
2b133a6
Update hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
elek Jul 29, 2020
674205c
Merge remote-tracking branch 'elek/HDDS-4033' into HDDS-4033
elek Jul 29, 2020
5c53c97
Apply suggestions from code review
elek Jul 29, 2020
05e5f50
Merge remote-tracking branch 'elek/HDDS-4033' into HDDS-4033
elek Jul 29, 2020
712a06c
Merge remote-tracking branch 'origin/master' into HDDS-4033
elek Jul 29, 2020
6a208ad
remove duplicated loads
elek Jul 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-mr/test.sh
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions hadoop-ozone/dist/src/main/compose/ozone-topology/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions hadoop-ozone/dist/src/main/compose/ozone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 10 additions & 20 deletions hadoop-ozone/dist/src/main/compose/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 23 additions & 1 deletion hadoop-ozone/dist/src/main/compose/testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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}')
Expand Down
37 changes: 37 additions & 0 deletions hadoop-ozone/dist/src/test/shell/compose_testlib.bats
Original file line number Diff line number Diff line change
@@ -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" ]]
}
15 changes: 15 additions & 0 deletions hadoop-ozone/dist/src/test/shell/test1/test.sh
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 17 additions & 0 deletions hadoop-ozone/dist/src/test/shell/test2/test.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions hadoop-ozone/dist/src/test/shell/test4/test.sh
Original file line number Diff line number Diff line change
@@ -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