HDDS-616. Collect all the robot test outputs and return with the right exit 
code. Contributed by Elek, Marton.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cdad91c0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cdad91c0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cdad91c0

Branch: refs/heads/HDFS-12943
Commit: cdad91c03985317ec7b1807246709444ff6d5da0
Parents: 28ca5c9
Author: Márton Elek <[email protected]>
Authored: Thu Oct 11 11:30:07 2018 +0200
Committer: Márton Elek <[email protected]>
Committed: Sat Oct 13 08:40:49 2018 +0200

----------------------------------------------------------------------
 hadoop-ozone/dist/src/main/smoketest/test.sh | 25 ++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cdad91c0/hadoop-ozone/dist/src/main/smoketest/test.sh
----------------------------------------------------------------------
diff --git a/hadoop-ozone/dist/src/main/smoketest/test.sh 
b/hadoop-ozone/dist/src/main/smoketest/test.sh
index f3c2224..a6dc1f1 100755
--- a/hadoop-ozone/dist/src/main/smoketest/test.sh
+++ b/hadoop-ozone/dist/src/main/smoketest/test.sh
@@ -17,19 +17,35 @@
 
 set -e
 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(){
-  COMPOSE_FILE=$DIR/../compose/$1/docker-compose.yaml
+  COMPOSE_DIR=$1
+  COMPOSE_FILE=$DIR/../compose/$COMPOSE_DIR/docker-compose.yaml
   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" up -d
   echo "Waiting 30s for cluster start up..."
   sleep 30
   for TEST in "${TESTS[@]}"; do
+     TITLE="Ozone $TEST tests with $COMPOSE_DIR cluster"
      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
+     docker-compose -f "$COMPOSE_FILE" logs > 
"$DIR/$RESULT_DIR/docker-$COMPOSE_DIR-${TEST//\//_/}.log"
   done
   if [ "$KEEP_RUNNING" = false ]; then
      docker-compose -f "$COMPOSE_FILE" down
@@ -99,3 +115,6 @@ if [ "$RUN_ALL" = true ]; then
 else
    execute_tests "$DOCKERENV" "${POSITIONAL[@]}"
 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"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to