Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use paratest for parallel test execution #5372

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-optional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
name: 'API: validate migrations'
runs-on: ubuntu-latest
env:
TEST_DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3test?serverVersion=15&charset=utf8
DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3?serverVersion=15&charset=utf8

services:
postgres:
Expand Down
36 changes: 32 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
- api-check-needed
if: needs.api-check-needed.outputs.should_skip != 'true'
env:
TEST_DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3test?serverVersion=15&charset=utf8
DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3?serverVersion=15&charset=utf8

services:
postgres:
Expand Down Expand Up @@ -279,7 +279,35 @@ jobs:
- run: php bin/console doctrine:migrations:migrate --no-interaction -e test
working-directory: api

- run: composer test
- run: |
php bin/console doctrine:database:create --no-interaction -e test
php bin/console doctrine:migrations:migrate --no-interaction -e test
env:
TEST_TOKEN: 1
working-directory: api

- run: |
php bin/console doctrine:database:create --no-interaction -e test
php bin/console doctrine:migrations:migrate --no-interaction -e test
env:
TEST_TOKEN: 2
working-directory: api

- run: |
php bin/console doctrine:database:create --no-interaction -e test
php bin/console doctrine:migrations:migrate --no-interaction -e test
env:
TEST_TOKEN: 3
working-directory: api

- run: |
php bin/console doctrine:database:create --no-interaction -e test
php bin/console doctrine:migrations:migrate --no-interaction -e test
env:
TEST_TOKEN: 4
working-directory: api

- run: composer paratest -- -p 4
working-directory: api
env:
PERFORMANCE_TEST_DEBUG_OUTPUT: ${{ vars.PERFORMANCE_TEST_DEBUG_OUTPUT }}
Expand Down Expand Up @@ -330,7 +358,7 @@ jobs:
- name: replace paths in lcov.info that they reflect repo path
run: |
sed -i "s|src/|frontend/src/|g" frontend/data/coverage/lcov.info

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
Expand Down Expand Up @@ -442,7 +470,7 @@ jobs:
parallel-finished: true
carryforward: "api,frontend,print,pdf"
fail-on-error: false

workflow-success:
name: workflow-success
needs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-api-performance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: '[reusable only] api performance tests'

on:
workflow_call:

jobs:
api-performance-test:
name: 'Tests: API performance tests'
runs-on: ubuntu-latest
env:
TEST_DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3test?serverVersion=15&charset=utf8
DATABASE_URL: postgresql://ecamp3:ecamp3@localhost:5432/ecamp3?serverVersion=15&charset=utf8

services:
postgres:
Expand Down
3 changes: 1 addition & 2 deletions api/.env
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ APP_SECRET=!ChangeMe!
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7"
DATABASE_URL="postgresql://ecamp3:ecamp3@database:5432/ecamp3dev?serverVersion=15&charset=utf8"
TEST_DATABASE_URL="postgresql://ecamp3:ecamp3@database:5432/ecamp3test?serverVersion=15&charset=utf8"
DATABASE_URL="postgresql://ecamp3:ecamp3@database:5432/ecamp3?serverVersion=15&charset=utf8"
###< doctrine/doctrine-bundle ###

###> nelmio/cors-bundle ###
Expand Down
5 changes: 5 additions & 0 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"webonyx/graphql-php": "15.12.5"
},
"require-dev": {
"brianium/paratest": "^7.4",
"friendsofphp/php-cs-fixer": "3.62.0",
"hautelook/alice-bundle": "2.13.0",
"justinrainbow/json-schema": "6.0.0",
Expand Down Expand Up @@ -114,6 +115,10 @@
"Composer\\Config::disableProcessTimeout",
"bin/phpunit -d memory_limit=-1"
],
"paratest": [
"Composer\\Config::disableProcessTimeout",
"vendor/bin/paratest --passthru-php=\"-d memory_limit=-1\""
],
"update-snapshots": [
"Composer\\Config::disableProcessTimeout",
"bin/phpunit -d memory_limit=-1 -d --update-snapshots tests/Api/SnapshotTests",
Expand Down
112 changes: 103 additions & 9 deletions api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/config/packages/dev/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: 'dev'
3 changes: 1 addition & 2 deletions api/config/packages/test/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
doctrine:
dbal:
url: '%env(resolve:TEST_DATABASE_URL)%'
# "TEST_TOKEN" is typically set by ParaTest
#dbname_suffix: '_test%env(default::TEST_TOKEN)%'
dbname_suffix: 'test%env(default::TEST_TOKEN)%'
Loading