1
0
mirror of https://github.com/quay/quay.git synced 2026-01-29 08:42:15 +03:00
Files
quay/tox.ini
Harish Govindarajulu 074f35ee99 chore: Update alembic migration script to support sqlite db (PROJQUAY-7097) (#2839)
* Add sqlite db support on quay start up

* Add batchmode to migration scripts to support sqlite db

* Add sqlite db to config-tool validator +  alembic migration

* Fix migration script to prevent db row locking

Added commit statement to ensure previous transaction is
completed before the next one within the same table

* Clean up unused sqlite volume

* Apply black formatting to migration scripts

* Address review comments

* Ensure py39-unit test runs the alembic migration on Sqlite

* Add static type checking for alembic config file name

* alembic remove commit and invalidate during migration

When disconnecting from db, alembic tries to rollback
causing PendingRollbackError

* Bump go version in config-tool Dockerfile

* Explicitly commit transaction to prevent db table locking

* Clean up + remove debug statements

* Undo database secret key change

* Add TEST_DATABASE_URI to py39-unit to run unit test with sqlite db

* Drop index before dropping column to prevent sqlite error

* Add test coverage + address last set of reviews

---------

Signed-off-by: harishsurf <hgovinda@redhat.com>
2024-06-12 13:57:32 -04:00

98 lines
3.2 KiB
INI

[tox]
envlist = py39-{unit,registry,e2e,mysql,psql}
skipsdist = True
[pytest]
norecursedirs = node_modules
testpaths = ./
python_files = **/test/test*.py
[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 -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:py39-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:py39-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 -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:py39-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 -m {env:MARKERS} --exitfirst --ignore=buildman/test/test_buildman.py -vv {env:FILE:} {posargs}'