Skip to content

Commit

Permalink
Properly read the value of testcontainers.reuse.enable
Browse files Browse the repository at this point in the history
As mentioned by @LaunchPairs in the analysis of #30059,
the use of TestcontainersConfiguration#getUserProperty
results in using only environment variables as the source
for reading the testcontainers.reuse.enable.
We should instead also read the value of ~/.testcontainers.properties
in order to ensure we write back the proper value when restoring

Fixes: #30059
(cherry picked from commit 0ff1d5d)
  • Loading branch information
geoand authored and gsmet committed Jan 4, 2023
1 parent 1b26430 commit 1da3c22
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Result get() {
.loadClass("org.testcontainers.utility.TestcontainersConfiguration");
Object configurationInstance = configurationClass.getMethod("getInstance").invoke(null);
String oldReusePropertyValue = (String) configurationClass
.getMethod("getUserProperty", String.class, String.class)
.getMethod("getEnvVarOrUserProperty", String.class, String.class)
.invoke(configurationInstance, "testcontainers.reuse.enable", "false"); // use the default provided in TestcontainersConfiguration#environmentSupportsReuse
Method updateUserConfigMethod = configurationClass.getMethod("updateUserConfig", String.class, String.class);
// this will ensure that testcontainers does not start ryuk - see https://github.com/quarkusio/quarkus/issues/25852 for why this is important
Expand Down

0 comments on commit 1da3c22

Please sign in to comment.