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 quarkusio#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: quarkusio#30059
  • Loading branch information
geoand committed Jan 3, 2023
1 parent 4fa6890 commit 0ff1d5d
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 0ff1d5d

Please sign in to comment.