From 0ff1d5d4e833abbfa3055a4dc39a1e09e77ce8ba Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 3 Jan 2023 12:59:51 +0200 Subject: [PATCH] Properly read the value of testcontainers.reuse.enable 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 --- .../src/main/java/io/quarkus/deployment/IsDockerWorking.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java index c504de2b24410..2b26c34844365 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java @@ -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