execute_tests.sh 686 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set +e
  3. DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
  4. ROOT_DIR=$(cd "$DIR/../../" && pwd)
  5. ROLE_DIR="$ROOT_DIR/roles/internal"
  6. export CI=true
  7. execute_test() {
  8. role=$1
  9. echo "Testing role $role"
  10. cd $ROLE_DIR/$role
  11. env KITCHEN_YAML=.kitchen.travis.yml kitchen test
  12. }
  13. EXIT_RC=0
  14. FAILED_ROLES=()
  15. cd $ROOT_DIR
  16. for role in $(ls $ROLE_DIR)
  17. do
  18. if [ -d "$ROLE_DIR/$role/test" ]; then
  19. execute_test $role
  20. RC=$?
  21. cd $ROOT_DIR
  22. if [ "$RC" != "0" ]; then
  23. FAILED_ROLES+=("$role")
  24. EXIT_RC=$RC
  25. fi
  26. sleep 5
  27. fi
  28. done
  29. if [ "$EXIT_RC" != "0" ]; then
  30. for role in ${FAILED_ROLES[@]}
  31. do
  32. echo "Role $role failed"
  33. done
  34. fi
  35. exit $EXIT_RC