run.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #Enable external storage app
  31. ../../occ app:enable files_external
  32. mkdir -p work/local_storage
  33. OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/work/local_storage`
  34. ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}`
  35. ../../occ files_external:option $ID_STORAGE enable_sharing true
  36. vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN
  37. RESULT=$?
  38. kill $PHPPID
  39. kill $PHPPID_FED
  40. ../../occ files_external:delete -y $ID_STORAGE
  41. #Disable external storage app
  42. ../../occ app:disable files_external
  43. if [ -z $HIDE_OC_LOGS ]; then
  44. tail "../../data/nextcloud.log"
  45. fi
  46. exit $RESULT