Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes several changes to speed up tests from 1h18min to ~20min.
Single Session-Scoped Postgres Container
Instead of creating a new Docker Postgres container for each test module, we now use a single session-scoped container that persists across all test workers. Individual test modules create their own databases within that container. DB creation is fast compared to Docker container startup.
Template Database Approach
This change involves a template database strategy, where we create a template database (template_all_examples) once at session start. This is pre-populated with all examples used for testing (roads, account revenue, dimension links, etc.)
Each test module clones from this template using PostgreSQL's
CREATE DATABASE ... TEMPLATEcommand, which eliminates the expensive API calls to load examples for each test module.Function-Scoped Database Cloning
For function-scoped fixtures that need isolation:
func__databasefixture that clones from the template for each test functionfunc__clean_postgres_containerandclean_sessionfixtures for tests that need a completely empty database (construction tests, seed tests).Test Plan
Many tests needed adjustment to work with the pre-populated template database:
make checkpassesmake testshows 100% unit test coverageDeployment Plan