mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
The default recursion limit used by Docker's archlinux:base-devel Python package becomes problematic in some cases when running tests against our FastAPI application using starlette.testclient.TestClient (aliased to fastapi.testclient.TestClient). starlette ends up with test failures because it exceeds the recursion limit, but this only happens when using the `TestClient`. When the ASGI servers are run, this is not an issue and so in that case, the recursion limit has not been touched. This change uses a `TEST_RECURSION_LIMIT` environment variable to modify the recursion limit of the FastAPI application. This variable is, by default, only supplied when running pytests in Docker, but can be force-supplied by the user. TEST_RECURSION_LIMIT=10000 has been added to `.env` and `.gitlab-ci.yml`. Signed-off-by: Kevin Morris <kevr@0cost.org>
43 lines
1.7 KiB
YAML
43 lines
1.7 KiB
YAML
image: archlinux:base-devel
|
|
|
|
cache:
|
|
key: system-v1
|
|
paths:
|
|
# For some reason Gitlab CI only supports storing cache/artifacts in a path relative to the build directory
|
|
- .pkg-cache
|
|
|
|
variables:
|
|
AUR_CONFIG: conf/config # Default MySQL config setup in before_script.
|
|
DB_HOST: localhost
|
|
TEST_RECURSION_LIMIT: 10000
|
|
|
|
before_script:
|
|
- export PATH="$HOME/.poetry/bin:${PATH}"
|
|
- ./docker/scripts/install-deps.sh
|
|
- ./docker/scripts/install-python-deps.sh
|
|
- useradd -U -d /aurweb -c 'AUR User' aur
|
|
- ./docker/mariadb-entrypoint.sh
|
|
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
|
|
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
|
|
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
|
|
- ./docker/test-sqlite-entrypoint.sh # Create sqlite AUR_CONFIG.
|
|
- make -C po all install
|
|
- python -m aurweb.initdb # Initialize MySQL tables.
|
|
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
|
|
- make -C test clean
|
|
|
|
test:
|
|
script:
|
|
- make -C test sh pytest # sharness tests use sqlite & pytest w/ mysql.
|
|
- AUR_CONFIG=conf/config.sqlite make -C test pytest
|
|
- make -C test coverage # Produce coverage reports.
|
|
- flake8 --count aurweb # Assert no flake8 violations in aurweb.
|
|
- flake8 --count test # Assert no flake8 violations in test.
|
|
- flake8 --count migrations # Assert no flake8 violations in migrations.
|
|
- isort --check-only aurweb # Assert no isort violations in aurweb.
|
|
- isort --check-only test # Assert no flake8 violations in test.
|
|
- isort --check-only migrations # Assert no flake8 violations in migrations.
|
|
coverage: '/TOTAL.*\s+(\d+\%)/'
|
|
artifacts:
|
|
reports:
|
|
cobertura: coverage.xml
|