testcontainers / testcontainers/testcontainers-java
[Feature]: Allow testcontainers.properties filename/pathname to be injected by property or env variable
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
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.propertiescan 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、testcontainers.properties がどのように検出され、TESTCONTAINERS_IMAGE_SUBSTITUTOR がどのように設定されるかを追跡します。提案されている testcontainers-ci.properties、testcontainers-ci-legacy.properties、testcontainers-ci-next.properties、testcontainers-ci-snapshot.properties という名前を、既存のデフォルト動作と比較します。デフォルト設定を変更せずに、プロパティまたは環境変数で別のファイルを選択できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- testing
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100