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

[CVAT][Exchange Oracle] Use Alembic in tests #2620

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Bobronium
Copy link
Collaborator

Summary of changes

Previously, to initialise test database, we've dropped all metadata then created it, based on current models. This lacked any awareness of our migrations and schema that was generated by it. Nothing really was testing how schema was applied from migrations, so error in alembic revision file wouldn't affect execution of tests and would be caught only on deployment attempt.

With these changes full alembic upgrade head and alembic downgrade base is ran before each test.

Since running plain alembic upgrade/downgrade commands is too slow due to isolated revision executions, before each test session, full SQL of alembic upgrade head and alembic downgrade head:base is generated, and then reused for each test case which speeds up things significantly.

After tests are executed, the database remains in a clean state with all migrations applied.

Existing migrations had to be modified a bit to ensure they could be rendered as raw SQL in offline mode.

How test the changes

Self-tested in CI.

Related issues

Copy link

vercel bot commented Oct 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 8:25pm
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 8:25pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Oct 9, 2024 8:25pm
faucet-server ⬜️ Ignored (Inspect) Oct 9, 2024 8:25pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant