run.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. COMPOSER=$(which composer)
  3. if [ -x "$COMPOSER" ]; then
  4. echo "Using composer executable $COMPOSER"
  5. else
  6. echo "Could not find composer executable" >&2
  7. exit 1
  8. fi
  9. # Disable bruteforce protection because the integration tests do trigger them
  10. ../../occ config:system:set auth.bruteforce.protection.enabled --value false --type bool
  11. composer install
  12. SCENARIO_TO_RUN=$1
  13. HIDE_OC_LOGS=$2
  14. # avoid port collision on jenkins - use $EXECUTOR_NUMBER
  15. if [ -z "$EXECUTOR_NUMBER" ]; then
  16. EXECUTOR_NUMBER=0
  17. fi
  18. PORT=$((8080 + $EXECUTOR_NUMBER))
  19. echo $PORT
  20. php -S localhost:$PORT -t ../.. &
  21. PHPPID=$!
  22. echo $PHPPID
  23. PORT_FED=$((8180 + $EXECUTOR_NUMBER))
  24. echo $PORT_FED
  25. php -S localhost:$PORT_FED -t ../.. &
  26. PHPPID_FED=$!
  27. echo $PHPPID_FED
  28. export TEST_SERVER_URL="http://localhost:$PORT/ocs/"
  29. export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/"
  30. vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN
  31. RESULT=$?
  32. kill $PHPPID
  33. kill $PHPPID_FED
  34. if [ -z $HIDE_OC_LOGS ]; then
  35. tail "../../data/nextcloud.log"
  36. fi
  37. exit $RESULT