Skip to content

Conversation

@Bobronium
Copy link
Contributor

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

@vercel
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 Nov 1, 2024 7:05pm
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 7:05pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview Nov 1, 2024 7:05pm
faucet-server ⬜️ Ignored (Inspect) Visit Preview Nov 1, 2024 7:05pm

@zhiltsov-max zhiltsov-max merged commit d1bc6d0 into develop Nov 4, 2024
15 checks passed
@flopez7 flopez7 deleted the ba/exchange-oracle/use-alembic-in-tests branch November 5, 2024 13:12
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.

3 participants