mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Another attempt to make API tests script sh compatible
This commit is contained in:
parent
8260a0843b
commit
f71c95b74a
@ -1,8 +1,10 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
export APP_ENV=test
|
export APP_ENV=test
|
||||||
export TEST_ENV=api
|
export TEST_ENV=api
|
||||||
export TEST_RUNTIME=${TEST_RUNTIME:-"openswoole"}
|
export TEST_RUNTIME="${TEST_RUNTIME:-"openswoole"}"
|
||||||
export DB_DRIVER=${DB_DRIVER:-"postgres"}
|
export DB_DRIVER="${DB_DRIVER:-"postgres"}"
|
||||||
export GENERATE_COVERAGE=${GENERATE_COVERAGE:-"no"}
|
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"
|
||||||
|
|
||||||
# Reset logs
|
# Reset logs
|
||||||
OUTPUT_LOGS=data/log/api-tests/output.log
|
OUTPUT_LOGS=data/log/api-tests/output.log
|
||||||
@ -11,12 +13,12 @@ mkdir data/log/api-tests
|
|||||||
touch $OUTPUT_LOGS
|
touch $OUTPUT_LOGS
|
||||||
|
|
||||||
# Try to stop server just in case it hanged in last execution
|
# Try to stop server just in case it hanged in last execution
|
||||||
[[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:stop
|
[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:stop
|
||||||
[[ $TEST_RUNTIME == 'rr' ]] && bin/rr stop -f
|
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -f
|
||||||
|
|
||||||
echo 'Starting server...'
|
echo 'Starting server...'
|
||||||
[[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:start -d
|
[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:start -d
|
||||||
[[ $TEST_RUNTIME == 'rr' ]] && bin/rr serve -p -c=config/roadrunner/.rr.dev.yml \
|
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr serve -p -c=config/roadrunner/.rr.dev.yml \
|
||||||
-o=http.address=0.0.0.0:9999 \
|
-o=http.address=0.0.0.0:9999 \
|
||||||
-o=logs.encoding=json \
|
-o=logs.encoding=json \
|
||||||
-o=logs.channels.http.encoding=json \
|
-o=logs.channels.http.encoding=json \
|
||||||
@ -29,8 +31,8 @@ sleep 2 # Let's give the server a couple of seconds to start
|
|||||||
vendor/bin/phpunit --order-by=random -c phpunit-api.xml --testdox --colors=always --log-junit=build/coverage-api/junit.xml $*
|
vendor/bin/phpunit --order-by=random -c phpunit-api.xml --testdox --colors=always --log-junit=build/coverage-api/junit.xml $*
|
||||||
testsExitCode=$?
|
testsExitCode=$?
|
||||||
|
|
||||||
[[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:stop
|
[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:stop
|
||||||
[[ $TEST_RUNTIME == 'rr' ]] && bin/rr stop -c config/roadrunner/.rr.dev.yml -o=http.address=0.0.0.0:9999
|
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -c config/roadrunner/.rr.dev.yml -o=http.address=0.0.0.0:9999
|
||||||
|
|
||||||
# Exit this script with the same code as the tests. If tests failed, this script has to fail
|
# Exit this script with the same code as the tests. If tests failed, this script has to fail
|
||||||
exit $testsExitCode
|
exit $testsExitCode
|
||||||
|
Loading…
Reference in New Issue
Block a user