This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 75b1e45  HDDS-1716. Smoketest results are generated with an internal 
user
75b1e45 is described below

commit 75b1e458b1a9fe48b27fdbe5422e4abb4a20b200
Author: Márton Elek <e...@apache.org>
AuthorDate: Tue Jul 2 22:51:04 2019 +0200

    HDDS-1716. Smoketest results are generated with an internal user
    
    Closes #1002
---
 hadoop-ozone/dist/src/main/compose/test-all.sh |  4 ++--
 hadoop-ozone/dist/src/main/compose/testlib.sh  | 24 +++++++++++++++++-------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/hadoop-ozone/dist/src/main/compose/test-all.sh 
b/hadoop-ozone/dist/src/main/compose/test-all.sh
index 8afb18b..5039207 100755
--- a/hadoop-ozone/dist/src/main/compose/test-all.sh
+++ b/hadoop-ozone/dist/src/main/compose/test-all.sh
@@ -29,7 +29,7 @@ rm "$ALL_RESULT_DIR/*"
 RESULT=0
 IFS=$'\n'
 # shellcheck disable=SC2044
-for test in $(find $SCRIPT_DIR -name test.sh); do
+for test in $(find "$SCRIPT_DIR" -name test.sh); do
   echo "Executing test in $(dirname "$test")"
 
   #required to read the .env file from the right location
@@ -43,5 +43,5 @@ for test in $(find $SCRIPT_DIR -name test.sh); do
   cp "$RESULT_DIR"/robot-*.xml "$ALL_RESULT_DIR"
 done
 
-docker run --rm -v "$SCRIPT_DIR/result:/opt/result" apache/ozone-runner rebot 
-N "smoketests" -d "/opt/result" "/opt/result/robot-*.xml"
+rebot -N "smoketests" -d "$SCRIPT_DIR/result" "$SCRIPT_DIR/result/robot-*.xml"
 exit $RESULT
diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh 
b/hadoop-ozone/dist/src/main/compose/testlib.sh
index ae813d4..fab4460 100755
--- a/hadoop-ozone/dist/src/main/compose/testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/testlib.sh
@@ -15,12 +15,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 set -e
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
 COMPOSE_ENV_NAME=$(basename "$COMPOSE_DIR")
 COMPOSE_FILE=$COMPOSE_DIR/docker-compose.yaml
-RESULT_DIR="$COMPOSE_DIR/result"
-RESULT_DIR_INSIDE="${OZONE_DIR:-/opt/hadoop}/compose/$(basename 
"$COMPOSE_ENV_NAME")/result"
+RESULT_DIR=${RESULT_DIR:-"$COMPOSE_DIR/result"}
+RESULT_DIR_INSIDE="/tmp/smoketest/$(basename "$COMPOSE_ENV_NAME")/result"
 SMOKETEST_DIR_INSIDE="${OZONE_DIR:-/opt/hadoop}/smoketest"
 
 #delete previous results
@@ -75,10 +74,15 @@ execute_robot_test(){
   CONTAINER="$1"
   TEST="$2"
   TEST_NAME=$(basename "$TEST")
-  TEST_NAME=${TEST_NAME%.*}
+  TEST_NAME="$(basename "$COMPOSE_DIR")-${TEST_NAME%.*}"
   set +e
   OUTPUT_NAME="$COMPOSE_ENV_NAME-$TEST_NAME-$CONTAINER"
-  docker-compose -f "$COMPOSE_FILE" exec -e  
SECURITY_ENABLED="${SECURITY_ENABLED}" -T "$CONTAINER" python -m robot --log 
NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output 
"$RESULT_DIR_INSIDE/robot-$OUTPUT_NAME.xml" "$SMOKETEST_DIR_INSIDE/$TEST"
+  OUTPUT_PATH="$RESULT_DIR_INSIDE/robot-$OUTPUT_NAME.xml"
+  docker-compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" mkdir -p 
"$RESULT_DIR_INSIDE"
+  docker-compose -f "$COMPOSE_FILE" exec -e  
SECURITY_ENABLED="${SECURITY_ENABLED}" -T "$CONTAINER" python -m robot --log 
NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output 
"$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST"
+
+  FULL_CONTAINER_NAME=$(docker-compose -f "$COMPOSE_FILE" ps | grep 
"_${CONTAINER}_" | head -n 1 | awk '{print $1}')
+  docker cp "$FULL_CONTAINER_NAME:$OUTPUT_PATH" "$RESULT_DIR/"
   set -e
 
 }
@@ -93,6 +97,12 @@ stop_docker_env(){
 
 ## @description  Generate robot framework reports based on the saved results.
 generate_report(){
-  #Generate the combined output and return with the right exit code (note: 
robot = execute test, rebot = generate output)
-  docker run --rm -v "$DIR/..:${OZONE_DIR:-/opt/hadoop}" apache/ozone-runner 
rebot -d "$RESULT_DIR_INSIDE" "$RESULT_DIR_INSIDE/robot-*.xml"
+
+  if command -v rebot > /dev/null 2>&1; then
+     #Generate the combined output and return with the right exit code (note: 
robot = execute test, rebot = generate output)
+     rebot -d "$RESULT_DIR" "$RESULT_DIR/robot-*.xml"
+  else
+     echo "Robot framework is not installed, the reports can be generated 
(sudo pip install robotframework)."
+     exit 1
+  fi
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to