Undone changes for sh on API tests

This commit is contained in:
Alejandro Celaya 2022-08-27 09:43:20 +02:00
parent bfbeb7b1fb
commit 8260a0843b
3 changed files with 16 additions and 24 deletions

View File

@ -28,6 +28,7 @@ jobs:
php-extensions: openswoole-4.11.1 php-extensions: openswoole-4.11.1
extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }} extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
- run: composer test:${{ inputs.test-group }}:ci - run: composer test:${{ inputs.test-group }}:ci
shell: bash
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: ${{ matrix.php-version == '8.1' }} if: ${{ matrix.php-version == '8.1' }}
with: with:

View File

@ -49,6 +49,7 @@ jobs:
- run: composer install --no-interaction --prefer-dist - run: composer install --no-interaction --prefer-dist
- run: ./vendor/bin/rr get --location bin/ && chmod +x bin/rr - run: ./vendor/bin/rr get --location bin/ && chmod +x bin/rr
- run: composer test:api:rr - run: composer test:api:rr
shell: bash
cli-tests: cli-tests:
uses: './.github/workflows/ci-tests.yml' uses: './.github/workflows/ci-tests.yml'

View File

@ -1,8 +1,7 @@
#!/usr/bin/env sh
export APP_ENV=test export APP_ENV=test
export DB_DRIVER=postgres
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 GENERATE_COVERAGE=${GENERATE_COVERAGE:-"no"} export GENERATE_COVERAGE=${GENERATE_COVERAGE:-"no"}
# Reset logs # Reset logs
@ -12,35 +11,26 @@ 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
if test "$TEST_RUNTIME" == 'openswoole'; then [[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:stop
vendor/bin/laminas mezzio:swoole:stop [[ $TEST_RUNTIME == 'rr' ]] && bin/rr stop -f
elif test "$TEST_RUNTIME" == 'rr'; then
bin/rr stop -f
fi
echo 'Starting server...' echo 'Starting server...'
if test "$TEST_RUNTIME" == 'openswoole'; then [[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:start -d
vendor/bin/laminas mezzio:swoole:start -d [[ $TEST_RUNTIME == 'rr' ]] && bin/rr serve -p -c=config/roadrunner/.rr.dev.yml \
elif test "$TEST_RUNTIME" == 'rr'; then -o=http.address=0.0.0.0:9999 \
bin/rr serve -p -c=config/roadrunner/.rr.dev.yml \ -o=logs.encoding=json \
-o=http.address=0.0.0.0:9999 \ -o=logs.channels.http.encoding=json \
-o=logs.encoding=json \ -o=logs.channels.server.encoding=json \
-o=logs.channels.http.encoding=json \ -o=logs.output="${PWD}/${OUTPUT_LOGS}" \
-o=logs.channels.server.encoding=json \ -o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \ -o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
-o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
fi
sleep 2 # Let's give the server a couple of seconds to start 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=$?
if test "$TEST_RUNTIME" == 'openswoole'; then [[ $TEST_RUNTIME == 'openswoole' ]] && vendor/bin/laminas mezzio:swoole:stop
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
elif test "$TEST_RUNTIME" == 'rr'; then
bin/rr stop -c config/roadrunner/.rr.dev.yml -o=http.address=0.0.0.0:9999
fi
# 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