HDDS-616. Collect all the robot test outputs and return with the right exit code. Contributed by Elek, Marton.
This commit is contained in:
parent
28ca5c9d16
commit
cdad91c039
|
@ -17,19 +17,35 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
RESULT_DIR=result
|
||||||
|
#delete previous results
|
||||||
|
rm -rf "${DIR:?}/$RESULT_DIR"
|
||||||
|
mkdir -p "$DIR/$RESULT_DIR"
|
||||||
|
#Should be writeable from the docker containers where user is different.
|
||||||
|
chmod ogu+w "$DIR/$RESULT_DIR"
|
||||||
|
|
||||||
execute_tests(){
|
execute_tests(){
|
||||||
COMPOSE_FILE=$DIR/../compose/$1/docker-compose.yaml
|
COMPOSE_DIR=$1
|
||||||
|
COMPOSE_FILE=$DIR/../compose/$COMPOSE_DIR/docker-compose.yaml
|
||||||
TESTS=$2
|
TESTS=$2
|
||||||
echo "Executing test ${TESTS[*]} with $COMPOSE_FILE"
|
echo "-------------------------------------------------"
|
||||||
|
echo "Executing test(s): [${TESTS[*]}]"
|
||||||
|
echo ""
|
||||||
|
echo " Cluster type: $COMPOSE_DIR"
|
||||||
|
echo " Compose file: $COMPOSE_FILE"
|
||||||
|
echo " Output dir: $DIR/$RESULT_DIR"
|
||||||
|
echo " Command to rerun: ./test.sh --keep --env $COMPOSE_DIR $TESTS"
|
||||||
|
echo "-------------------------------------------------"
|
||||||
docker-compose -f "$COMPOSE_FILE" down
|
docker-compose -f "$COMPOSE_FILE" down
|
||||||
docker-compose -f "$COMPOSE_FILE" up -d
|
docker-compose -f "$COMPOSE_FILE" up -d
|
||||||
echo "Waiting 30s for cluster start up..."
|
echo "Waiting 30s for cluster start up..."
|
||||||
sleep 30
|
sleep 30
|
||||||
for TEST in "${TESTS[@]}"; do
|
for TEST in "${TESTS[@]}"; do
|
||||||
|
TITLE="Ozone $TEST tests with $COMPOSE_DIR cluster"
|
||||||
set +e
|
set +e
|
||||||
docker-compose -f "$COMPOSE_FILE" exec datanode python -m robot "smoketest/$TEST"
|
docker-compose -f "$COMPOSE_FILE" exec datanode python -m robot --log NONE --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "smoketest/$RESULT_DIR/robot-$COMPOSE_DIR-${TEST//\//_/}.xml" --logtitle "$TITLE" --reporttitle "$TITLE" "smoketest/$TEST"
|
||||||
set -e
|
set -e
|
||||||
|
docker-compose -f "$COMPOSE_FILE" logs > "$DIR/$RESULT_DIR/docker-$COMPOSE_DIR-${TEST//\//_/}.log"
|
||||||
done
|
done
|
||||||
if [ "$KEEP_RUNNING" = false ]; then
|
if [ "$KEEP_RUNNING" = false ]; then
|
||||||
docker-compose -f "$COMPOSE_FILE" down
|
docker-compose -f "$COMPOSE_FILE" down
|
||||||
|
@ -99,3 +115,6 @@ if [ "$RUN_ALL" = true ]; then
|
||||||
else
|
else
|
||||||
execute_tests "$DOCKERENV" "${POSITIONAL[@]}"
|
execute_tests "$DOCKERENV" "${POSITIONAL[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Generate the combined output and return with the right exit code (note: robot = execute test, rebot = generate output)
|
||||||
|
docker run --rm -it -v "$DIR/..:/opt/hadoop" apache/hadoop-runner rebot -d "smoketest/$RESULT_DIR" "smoketest/$RESULT_DIR/robot-*.xml"
|
||||||
|
|
Loading…
Reference in New Issue