robot-dnd-all.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. set -x
  17. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  18. #Dir od the definition of the dind based test exeucution container
  19. DOCKERDIR="$DIR/../docker"
  20. #Dir to save the results
  21. TARGETDIR="$DIR/../../target/dnd"
  22. #Dir to mount the distribution from
  23. OZONEDIST="$DIR/../../../../hadoop-dist/target/ozone"
  24. #Name and imagename of the temporary, dind based test containers
  25. DOCKER_IMAGE_NAME=ozoneacceptance
  26. DOCKER_INSTANCE_NAME="${DOCKER_INSTANCE_NAME:-ozoneacceptance}"
  27. teardown() {
  28. docker stop "$DOCKER_INSTANCE_NAME"
  29. }
  30. trap teardown EXIT
  31. #Make sure it will work even if the ozone is built by an other user. We
  32. # eneable to run the distribution by an other user
  33. mkdir -p "$TARGETDIR"
  34. mkdir -p "$OZONEDIST/logs"
  35. chmod o+w "$OZONEDIST/logs" || true
  36. chmod -R o+w "$OZONEDIST/etc/hadoop" || true
  37. chmod o+w "$OZONEDIST" || true
  38. rm "$TARGETDIR/docker-compose.log"
  39. docker rm "$DOCKER_INSTANCE_NAME" || true
  40. docker build -t "$DOCKER_IMAGE_NAME" $DIR/../docker
  41. #Starting the dind based environment
  42. docker run --rm -v $DIR/../../../..:/opt/hadoop --privileged -d --name "$DOCKER_INSTANCE_NAME" $DOCKER_IMAGE_NAME
  43. sleep 5
  44. #Starting the tests
  45. docker exec "$DOCKER_INSTANCE_NAME" /opt/hadoop/hadoop-ozone/acceptance-test/dev-support/bin/robot-all.sh
  46. RESULT=$?
  47. docker cp "$DOCKER_INSTANCE_NAME:/root/log.html" "$TARGETDIR/"
  48. docker cp "$DOCKER_INSTANCE_NAME:/root/junit-results.xml" "$TARGETDIR/"
  49. docker cp "$DOCKER_INSTANCE_NAME:/root/docker-compose.log" "$TARGETDIR/"
  50. exit $RESULT