mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-16 15:29:54 +03:00
Merge pull request #2002 from acelaya-forks/feature/rr-e2e-tests
Feature/rr e2e tests
This commit is contained in:
commit
72c4628b79
7 changed files with 68 additions and 21 deletions
5
.github/workflows/ci-tests.yml
vendored
5
.github/workflows/ci-tests.yml
vendored
|
@ -14,6 +14,8 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.2', '8.3']
|
php-version: ['8.2', '8.3']
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # rr get-binary picks this env automatically
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Start postgres database server
|
- name: Start postgres database server
|
||||||
|
@ -27,6 +29,9 @@ jobs:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
php-extensions: openswoole-22.1.2
|
php-extensions: openswoole-22.1.2
|
||||||
extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
|
extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
|
||||||
|
- name: Download RoadRunner binary
|
||||||
|
if: ${{ inputs.test-group == 'api' }}
|
||||||
|
run: ./vendor/bin/rr get --no-interaction --no-config --location bin/ && chmod +x bin/rr
|
||||||
- run: composer test:${{ inputs.test-group }}:ci
|
- run: composer test:${{ inputs.test-group }}:ci
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ matrix.php-version == '8.2' }}
|
if: ${{ matrix.php-version == '8.2' }}
|
||||||
|
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -50,28 +50,26 @@ jobs:
|
||||||
with:
|
with:
|
||||||
test-group: cli
|
test-group: cli
|
||||||
|
|
||||||
openswoole-api-tests:
|
roadrunner-api-tests:
|
||||||
uses: './.github/workflows/ci-tests.yml'
|
uses: './.github/workflows/ci-tests.yml'
|
||||||
with:
|
with:
|
||||||
test-group: api
|
test-group: api
|
||||||
|
|
||||||
roadrunner-api-tests:
|
openswoole-api-tests:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.2', '8.3']
|
php-version: ['8.2', '8.3']
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # rr get-binary picks this env automatically
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
- run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
||||||
- uses: shivammathur/setup-php@v2
|
- uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
|
extensions: openswoole-22.1.2
|
||||||
tools: composer
|
tools: composer
|
||||||
- run: composer install --no-interaction --prefer-dist --ignore-platform-req=ext-openswoole
|
- run: composer install --no-interaction --prefer-dist
|
||||||
- run: ./vendor/bin/rr get --no-interaction --no-config --location bin/ && chmod +x bin/rr
|
- run: composer test:api:openswoole
|
||||||
- run: composer test:api:rr
|
|
||||||
|
|
||||||
sqlite-db-tests:
|
sqlite-db-tests:
|
||||||
uses: './.github/workflows/ci-db-tests.yml'
|
uses: './.github/workflows/ci-db-tests.yml'
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
.idea
|
.idea
|
||||||
bin/rr
|
bin/rr
|
||||||
config/roadrunner/.pid
|
.pid
|
||||||
build
|
build
|
||||||
!docker/build
|
!docker/build
|
||||||
composer.lock
|
composer.lock
|
||||||
|
|
|
@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
||||||
* [#1935](https://github.com/shlinkio/shlink/issues/1935) Replace dependency on abandoned `php-middleware/request-id` with userland simple middleware.
|
* [#1935](https://github.com/shlinkio/shlink/issues/1935) Replace dependency on abandoned `php-middleware/request-id` with userland simple middleware.
|
||||||
* [#1988](https://github.com/shlinkio/shlink/issues/1988) Remove dependency on `league\uri` package.
|
* [#1988](https://github.com/shlinkio/shlink/issues/1988) Remove dependency on `league\uri` package.
|
||||||
* [#1909](https://github.com/shlinkio/shlink/issues/1909) Update docker image to PHP 8.3.
|
* [#1909](https://github.com/shlinkio/shlink/issues/1909) Update docker image to PHP 8.3.
|
||||||
|
* [#1786](https://github.com/shlinkio/shlink/issues/1786) Run API tests with RoadRunner by default.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
* *Nothing*
|
* *Nothing*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
export APP_ENV=test
|
export APP_ENV=test
|
||||||
export TEST_ENV=api
|
export TEST_ENV=api
|
||||||
export TEST_RUNTIME="${TEST_RUNTIME:-"openswoole"}" # Openswoole is deprecated. Remove in v4.0.0
|
export TEST_RUNTIME="${TEST_RUNTIME:-"rr"}" # Openswoole is deprecated. Remove in v4.0.0
|
||||||
export DB_DRIVER="${DB_DRIVER:-"postgres"}"
|
export DB_DRIVER="${DB_DRIVER:-"postgres"}"
|
||||||
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"
|
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"
|
||||||
|
|
||||||
|
@ -18,13 +18,7 @@ touch $OUTPUT_LOGS
|
||||||
|
|
||||||
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.test.yml -w . \
|
||||||
-o=http.address=0.0.0.0:9999 \
|
|
||||||
-o=http.pool.debug=false \
|
|
||||||
-o=jobs.pool.debug=false \
|
|
||||||
-o=logs.encoding=json \
|
|
||||||
-o=logs.channels.http.encoding=json \
|
|
||||||
-o=logs.channels.server.encoding=json \
|
|
||||||
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \
|
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \
|
||||||
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
|
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
|
||||||
-o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
|
-o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
|
||||||
|
|
|
@ -50,10 +50,10 @@
|
||||||
"shlinkio/shlink-installer": "dev-develop#9f0d7e5 as 9.0",
|
"shlinkio/shlink-installer": "dev-develop#9f0d7e5 as 9.0",
|
||||||
"shlinkio/shlink-ip-geolocation": "^3.4",
|
"shlinkio/shlink-ip-geolocation": "^3.4",
|
||||||
"shlinkio/shlink-json": "^1.1",
|
"shlinkio/shlink-json": "^1.1",
|
||||||
"spiral/roadrunner": "^2023.2",
|
"spiral/roadrunner": "^2023.3",
|
||||||
"spiral/roadrunner-cli": "^2.5",
|
"spiral/roadrunner-cli": "^2.6",
|
||||||
"spiral/roadrunner-http": "^3.1",
|
"spiral/roadrunner-http": "^3.3",
|
||||||
"spiral/roadrunner-jobs": "^4.0",
|
"spiral/roadrunner-jobs": "^4.3",
|
||||||
"symfony/console": "^6.4",
|
"symfony/console": "^6.4",
|
||||||
"symfony/filesystem": "^6.4",
|
"symfony/filesystem": "^6.4",
|
||||||
"symfony/lock": "^6.4",
|
"symfony/lock": "^6.4",
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
"test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite",
|
"test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite",
|
||||||
"test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite",
|
"test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite",
|
||||||
"test:api": "bin/test/run-api-tests.sh",
|
"test:api": "bin/test/run-api-tests.sh",
|
||||||
"test:api:rr": "TEST_RUNTIME=rr bin/test/run-api-tests.sh",
|
"test:api:openswoole": "TEST_RUNTIME=openswoole bin/test/run-api-tests.sh",
|
||||||
"test:api:ci": "GENERATE_COVERAGE=yes composer test:api",
|
"test:api:ci": "GENERATE_COVERAGE=yes composer test:api",
|
||||||
"test:api:pretty": "GENERATE_COVERAGE=pretty composer test:api",
|
"test:api:pretty": "GENERATE_COVERAGE=pretty composer test:api",
|
||||||
"test:cli": "APP_ENV=test DB_DRIVER=maria TEST_ENV=cli php vendor/bin/phpunit --order-by=random --colors=always --testdox -c phpunit-cli.xml --log-junit=build/coverage-cli/junit.xml",
|
"test:cli": "APP_ENV=test DB_DRIVER=maria TEST_ENV=cli php vendor/bin/phpunit --order-by=random --colors=always --testdox -c phpunit-cli.xml --log-junit=build/coverage-cli/junit.xml",
|
||||||
|
|
49
config/roadrunner/.rr.test.yml
Normal file
49
config/roadrunner/.rr.test.yml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
############################################################################################
|
||||||
|
# Routes here need to be relative to the project root, as API tests are run with `-w .` #
|
||||||
|
# See https://github.com/orgs/roadrunner-server/discussions/1440#discussioncomment-8486186 #
|
||||||
|
############################################################################################
|
||||||
|
|
||||||
|
rpc:
|
||||||
|
listen: tcp://127.0.0.1:6001
|
||||||
|
|
||||||
|
server:
|
||||||
|
command: 'php ./bin/roadrunner-worker.php'
|
||||||
|
|
||||||
|
http:
|
||||||
|
address: '0.0.0.0:9999'
|
||||||
|
middleware: ['static']
|
||||||
|
static:
|
||||||
|
dir: './public'
|
||||||
|
forbid: ['.php', '.htaccess']
|
||||||
|
pool:
|
||||||
|
num_workers: 1
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pool:
|
||||||
|
num_workers: 1
|
||||||
|
debug: false
|
||||||
|
timeout: 300
|
||||||
|
consume: ['shlink']
|
||||||
|
pipelines:
|
||||||
|
shlink:
|
||||||
|
driver: memory
|
||||||
|
config:
|
||||||
|
priority: 10
|
||||||
|
prefetch: 10
|
||||||
|
|
||||||
|
logs:
|
||||||
|
encoding: json
|
||||||
|
mode: development
|
||||||
|
channels:
|
||||||
|
http:
|
||||||
|
mode: 'off' # Disable logging as Shlink handles it internally
|
||||||
|
server:
|
||||||
|
encoding: json
|
||||||
|
level: info
|
||||||
|
metrics:
|
||||||
|
level: panic
|
||||||
|
jobs:
|
||||||
|
level: panic
|
Loading…
Add table
Reference in a new issue