Simplify testing infrastructure by removing DM_TEST_SRC and implementing template-based test generation #2310
+450
−74
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.
This PR modernizes the testing infrastructure by removing the global
DM_TEST_SRC
environment variable dependency and implementing a template-based system for database-specific test duplication.Problem
The previous testing system relied heavily on the
DM_TEST_SRC
environment variable to switch between different database backends (postgres, maria, mssql, sqlite, duckdb). This created several issues:DM_TEST_SRC
Solution
Template-Based Test Generation
Created a new system where database-specific tests are generated from a single template:
tests/testthat/template-db-tests.R
contains test logic with{{DATABASE}}
placeholdersgenerate-db-tests.sh
replaces placeholders and creates individual test filesInfrastructure Modernization
DM_TEST_SRC
toDM_SETUP_DB
for cleaner database service configurationmake generate-db-tests
target and removed environment variable dependenciesBenefits
Usage
The template system ensures that database-specific tests remain synchronized while eliminating the complexity of the previous environment variable-based approach.
Fixes #1981.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.