Skip to content

Squash Alembic migrations to improve test execution time #17590

Open
@DarkaMaul

Description

@DarkaMaul

warehouse test suite currently executes 246 Alembic migrations sequentially during database setup, adding significant overhead to test execution times. I investigated squashing these migrations into a single migration that represents the current database state.

Using alembic's automatic migration feature provides a good starting point, but requires manual review to address limitations:

  1. SQL functions are not automatically exported
  2. Triggers are not included in the export
Configuration Full Tests API Tests
With Squash 19.69s 3.12s
Without Squash 21.75s 3.66s

Note: Currently experiencing 128 failures out of 4402 tests in the full test suite, while API tests are passing successfully.

Proposed Implementation:

  1. Preserve historical migrations by moving them to migrations/old/
  2. Replace current migrations with a single consolidated migration in migrations/versions/

Primary Consideration:

The main tradeoff is losing the ability to easily roll back to intermediate database states. We could mitigate this by choosing an earlier cutoff date for the consolidated migration if needed.

I'm opening this issue to discuss if we should proceed forward before trying to fix every edge case in the migration.

/cc @miketheman @woodruffw

Metadata

Metadata

Assignees

No one assigned

    Labels

    developer experienceAnything that improves the experience for Warehouse devstestingTest infrastructure and individual tests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions