mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
* chore: update ci to use new large ubuntu 24.04 runner Signed-off-by: Brady Pratt <bpratt@redhat.com> Co-Authored-By: Dave O'Connor <doconnor@redhat.com> * fix: add libfreetype6-dev for Ubuntu 24.04 compatibility The reportlab package requires FreeType development headers to build. On Ubuntu 24.04, this dependency is not pulled in transitively and must be explicitly installed. This fixes the "cannot find ft2build.h" build error. Added libfreetype6-dev to all jobs that install system dependencies in CI.yaml and CI-nightly.yaml workflows. Signed-off-by: Brady Pratt <bpratt@redhat.com> Co-Authored-By: Dave O'Connor <doconnor@redhat.com> * chore: set the TEST_DATETIME to a static value this caused an issue in xdist when generating test names Signed-off-by: Brady Pratt <bpratt@redhat.com> * chore: cache pip packages in CI Signed-off-by: Brady Pratt <bpratt@redhat.com> * chore: run registry tests with -n auto Signed-off-by: Brady Pratt <bpratt@redhat.com> * chore: run psql with -n auto Signed-off-by: Brady Pratt <bpratt@redhat.com> * chore: add file locking to prevent parallel test db init race condition When running pytest -n auto with multiple workers, both workers would simultaneously execute populate_database(), causing duplicate key violations on shared tables like imagestoragelocation: Worker 1: Check if User "devtable" exists → No → Start populating Worker 2: Check if User "devtable" exists → No → Start populating Both: INSERT INTO imagestoragelocation (name) VALUES ('local_eu') Result: IntegrityError - duplicate key violation Solution: Wrap init_db_path fixture with FileLock to ensure only one worker initializes the database at a time. The lock file is created in pytest's shared temp directory, coordinating across all workers. - First worker acquires lock and populates database - Subsequent workers wait at lock, then see database is already populated (via User.get() check in populate_database()) - Works for both PostgreSQL and MySQL - 300-second timeout prevents deadlocks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: run mysql with -n auto Signed-off-by: Brady Pratt <bpratt@redhat.com> --------- Signed-off-by: Brady Pratt <bpratt@redhat.com> Co-authored-by: Dave O'Connor <doconnor@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
100 lines
3.2 KiB
INI
100 lines
3.2 KiB
INI
[tox]
|
|
envlist = py312-{unit,registry,e2e,mysql,psql}
|
|
skipsdist = True
|
|
|
|
[pytest]
|
|
norecursedirs = node_modules
|
|
testpaths = ./
|
|
python_files = **/test/test*.py
|
|
log_cli = 0
|
|
log_cli_level = INFO
|
|
|
|
[testenv]
|
|
deps =
|
|
-r{toxinidir}/requirements-dev.txt
|
|
setenv =
|
|
PYTHONDONTWRITEBYTECODE = 1
|
|
PYTHONPATH={toxinidir}{:}{toxinidir}
|
|
TEST=true
|
|
MARKERS="not e2e"
|
|
registry: FILE=test/registry/registry_tests.py
|
|
e2e: MARKERS="e2e"
|
|
# TODO(kleesc): Re-enable buildman tests after buildman rewrite
|
|
commands =
|
|
python --version
|
|
alembic upgrade head
|
|
pytest --timeout=3600 -n auto -m {env:MARKERS} --exitfirst --ignore=buildman/test/test_buildman.py -vv {env:FILE:} {posargs}
|
|
|
|
[docker:mysql]
|
|
image = mysql:5.7
|
|
healthcheck_cmd = mysql -uroot -D information_schema -e "SELECT * FROM plugins LIMIT 0;"
|
|
healthcheck_interval = 25
|
|
healthcheck_timeout = 10
|
|
healthcheck_retries = 3
|
|
healthcheck_start_period = 25
|
|
ports = 3306:3306/tcp
|
|
environment =
|
|
MYSQL_DATABASE=quay_ci
|
|
MYSQL_PASSWORD=quay
|
|
MYSQL_ALLOW_EMPTY_PASSWORD=1
|
|
MYSQL_USER=quay
|
|
|
|
[testenv:py312-unit]
|
|
setenv =
|
|
PYTHONDONTWRITEBYTECODE = 1
|
|
PYTHONPATH={toxinidir}{:}{toxinidir}
|
|
TEST=true
|
|
SKIP_DB_SCHEMA=true
|
|
MARKERS="not e2e"
|
|
TEST_DATABASE_URI=sqlite:///test/data/sqlite_test.db
|
|
commands =
|
|
python --version
|
|
alembic upgrade head
|
|
pytest --timeout=3600 -m {env:MARKERS} --exitfirst --ignore=buildman/test/test_buildman.py -vv {env:FILE:} {posargs}
|
|
|
|
[testenv:py312-mysql]
|
|
setenv =
|
|
PYTHONDONTWRITEBYTECODE = 1
|
|
PYTHONPATH={toxinidir}{:}{toxinidir}
|
|
TEST=true
|
|
SKIP_DB_SCHEMA=true
|
|
MARKERS="not e2e"
|
|
docker = mysql
|
|
whitelist_internals = /bin/sh
|
|
allowlist_externals = /bin/sh
|
|
# TODO(kleesc): Re-enable buildman tests after buildman rewrite
|
|
commands =
|
|
python --version
|
|
/bin/sh -c "TEST_DATABASE_URI=mysql+pymysql://quay:quay@127.0.0.1:$MYSQL_3306_TCP_PORT/quay_ci alembic upgrade head"
|
|
/bin/sh -c 'TEST_DATABASE_URI=mysql+pymysql://quay:quay@127.0.0.1:$MYSQL_3306_TCP_PORT/quay_ci pytest --timeout=3600 -n auto -m {env:MARKERS} --exitfirst --ignore=buildman/test/test_buildman.py -vv {env:FILE:} {posargs}'
|
|
|
|
[docker:postgres]
|
|
image = postgres:12.1
|
|
healthcheck_cmd = PGPASSWORD=root pg_isready -U postgres
|
|
healthcheck_interval = 5
|
|
healthcheck_timeout = 10
|
|
healthcheck_retries = 3
|
|
healthcheck_start_period = 10
|
|
environment =
|
|
POSTGRES_DB=quay_ci
|
|
POSTGRES_PASSWORD=quay
|
|
POSTGRES_USER=quay
|
|
|
|
[testenv:py312-psql]
|
|
# TODO(kleesc): Re-enable buildman tests after buildman rewrite
|
|
setenv =
|
|
PYTHONDONTWRITEBYTECODE = 1
|
|
PYTHONPATH={toxinidir}{:}{toxinidir}
|
|
TEST=true
|
|
SKIP_DB_SCHEMA=true
|
|
MARKERS="not e2e"
|
|
docker = postgres
|
|
whitelist_internals = /bin/sh
|
|
allowlist_externals = /bin/sh
|
|
# TODO(kleesc): Re-enable buildman tests after buildman rewrite
|
|
commands =
|
|
python --version
|
|
/bin/sh -c "docker exec $(docker ps -q -n 1) psql -U quay -d quay_ci -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'"
|
|
/bin/sh -c "TEST_DATABASE_URI=postgresql://quay:quay@127.0.0.1:$POSTGRES_5432_TCP_PORT/quay_ci alembic upgrade head"
|
|
/bin/sh -c 'TEST_DATABASE_URI=postgresql://quay:quay@127.0.0.1:$POSTGRES_5432_TCP_PORT/quay_ci pytest --timeout=3600 -n auto -m {env:MARKERS} --exitfirst --ignore=buildman/test/test_buildman.py -vv {env:FILE:} {posargs}'
|