Description
Module
Core
Problem
For Spring Data Relational, we have two submodules, Spring Data JDBC and Spring Data R2DBC. For each of these to test properly, we need to apply a custom ImageNameSubstitutor
that rewrites the canonical name of each container we use for testing.
However, these submodules each must have their own version of this image name substitutor since there is no common test-based artifact to draw upon. This drives us to create org.springframework.data.jdbc.support.ProxyImageNameSubstitutor
as well as org.springframework.data.r2dbc.support.ProxyImageNameSubstitutor
. However, there is only one TESTCONTAINERS_IMAGE_SUBSTITUTOR
we can apply.
An alternative idea would be to have a testcontainers.properties
in each submodule, each pointing to its respective image name substitutor, but the way things are now, this file would get applied unconditionally whether or not we are building on CI. Building locally, we'd rather NOT do a substutition.
Solution
If it were possible to have a different name, like testcontainers-ci.properties
that is then injected by setting some env variable on CI, this configuration would ONLY kick in on CI.
This also opens the door to different CI stages able to run alternative flavors, like testcontainers-ci-legacy.properties
, testcontainers-ci-next.properties
, testcontainers-ci-snapshot.properties
, whatever. Each being applied in a different CI stage.
Benefit
- This makes it so that multiple versions of
testcontainers.properties
can be crafted and maintained within the same project - It also makes it possible to split up image name substitutors and make each of them simpler instead of injecting one mega-name substitutor with uber smarts.
Alternatives
I can write a script whereby the testcontainers.properties
file is stash elsewhere or with a different name and have the CI server copy it into the "right" name so that it only kicks in during a CI run, but that seems like a bit of a hack.
Would you like to help contributing this feature?
Yes