This is an automated email from the ASF dual-hosted git repository.

jinwoo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new c4878a45ea GEODE-10459: upgrade testcontainers from 1.17.6 to 1.21.3 
(#7916)
c4878a45ea is described below

commit c4878a45ead5e8da385f23273fc98068d26c2340
Author: Arnout Engelen <[email protected]>
AuthorDate: Wed Aug 27 22:38:58 2025 +0200

    GEODE-10459: upgrade testcontainers from 1.17.6 to 1.21.3 (#7916)
    
    * GEODE-10459: upgrade testcontainers
    
    The acceptance tests appear to fail because `docker-compose` does not
    exist. Likely the GHA machines have moved to the new `docker compose`
    convention. This attempts upgrading testcontainers, as testcontainers is
    what's starting docker compose, and newer versions indeed do it through
    the `docker` executable.
    
    * Change DockerComposeContainer to ComposeContainer
    
    To use docker v2 instead of v1.
    
    Also use new '-' separator naming convention
---
 .../gradle/plugins/DependencyConstraints.groovy      |  2 +-
 .../org/apache/geode/rules/DockerComposeRule.java    | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy
 
b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy
index 34fb141dbe..d44731cabc 100644
--- 
a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy
+++ 
b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy
@@ -166,7 +166,7 @@ class DependencyConstraints {
         api(group: 'org.springframework.hateoas', name: 'spring-hateoas', 
version: '1.5.0')
         api(group: 'org.springframework.ldap', name: 'spring-ldap-core', 
version: '2.4.0')
         api(group: 'org.springframework.shell', name: 'spring-shell', version: 
get('springshell.version'))
-        api(group: 'org.testcontainers', name: 'testcontainers', version: 
'1.17.6')
+        api(group: 'org.testcontainers', name: 'testcontainers', version: 
'1.21.3')
         api(group: 'pl.pragmatists', name: 'JUnitParams', version: '1.1.0')
         api(group: 'xerces', name: 'xercesImpl', version: '2.12.0')
         api(group: 'xml-apis', name: 'xml-apis', version: '1.4.01')
diff --git 
a/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java
 
b/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java
index 93cf342f08..96d1015e99 100644
--- 
a/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java
+++ 
b/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java
@@ -30,9 +30,9 @@ import org.junit.rules.RuleChain;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 import org.testcontainers.DockerClientFactory;
+import org.testcontainers.containers.ComposeContainer;
 import org.testcontainers.containers.Container;
 import org.testcontainers.containers.ContainerState;
-import org.testcontainers.containers.DockerComposeContainer;
 import org.testcontainers.containers.output.BaseConsumer;
 import org.testcontainers.containers.output.FrameConsumerResultCallback;
 import org.testcontainers.containers.output.OutputFrame;
@@ -77,7 +77,7 @@ public class DockerComposeRule extends ExternalResource {
   private final RuleChain delegate;
   private final String composeFile;
   private final Map<String, List<Integer>> exposedServices;
-  private DockerComposeContainer<?> composeContainer;
+  private ComposeContainer composeContainer;
 
   public DockerComposeRule(String composeFile, Map<String, List<Integer>> 
exposedServices) {
     this.composeFile = composeFile;
@@ -94,7 +94,7 @@ public class DockerComposeRule extends ExternalResource {
       @Override
       public void evaluate() throws Throwable {
 
-        composeContainer = new DockerComposeContainer<>("compose", new 
File(composeFile));
+        composeContainer = new ComposeContainer("compose", new 
File(composeFile));
         exposedServices.forEach((service, ports) -> ports
             .forEach(p -> composeContainer.withExposedService(service, p)));
         composeContainer.withLocalCompose(true);
@@ -116,7 +116,7 @@ public class DockerComposeRule extends ExternalResource {
    * When used with compose, testcontainers does not allow one to have a 
'container_name'
    * attribute in the compose file. This means that container names end up 
looking something like:
    * {@code project_service_index}. When a container performs a reverse IP 
lookup it will get a
-   * hostname that looks something like {@code projectjkh_db_1.my-network}. 
This can be a problem
+   * hostname that looks something like {@code projectjkh-db-1.my-network}. 
This can be a problem
    * since this hostname is not RFC compliant as it contains underscores. This 
may cause problems
    * in particular with SSL.
    *
@@ -126,7 +126,7 @@ public class DockerComposeRule extends ExternalResource {
    * @throws IllegalArgumentException if the service cannot be found
    */
   public void setContainerName(String serviceName, String newName) {
-    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "_1")
+    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "-1")
         .orElseThrow(() -> new IllegalArgumentException("Unknown service name: 
" + serviceName));
 
     String containerId = container.getContainerId();
@@ -141,7 +141,7 @@ public class DockerComposeRule extends ExternalResource {
    * @return the stdout of the container if the command was successful, else 
the stderr
    */
   public String execForService(String serviceName, String... command) {
-    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "_1")
+    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "-1")
         .orElseThrow(() -> new IllegalArgumentException("Unknown service name: 
" + serviceName));
     Container.ExecResult result;
     try {
@@ -159,7 +159,7 @@ public class DockerComposeRule extends ExternalResource {
    * @return the exit code of the command
    */
   public Long loggingExecForService(String serviceName, String... command) {
-    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "_1")
+    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "-1")
         .orElseThrow(() -> new IllegalArgumentException("Unknown service name: 
" + serviceName));
 
     String containerId = container.getContainerId();
@@ -208,7 +208,7 @@ public class DockerComposeRule extends ExternalResource {
    * @return the ip address
    */
   public String getIpAddressForService(String serviceName, String network) {
-    Map networks = composeContainer.getContainerByServiceName(serviceName + 
"_1").get()
+    Map networks = composeContainer.getContainerByServiceName(serviceName + 
"-1").get()
         .getCurrentContainerInfo().getNetworkSettings().getNetworks();
     for (Object object : networks.entrySet()) {
       String key = (String) ((Map.Entry<?, ?>) object).getKey();
@@ -229,7 +229,7 @@ public class DockerComposeRule extends ExternalResource {
    * @param serviceName the service to pause
    */
   public void pauseService(String serviceName) {
-    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "_1")
+    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "-1")
         .orElseThrow(() -> new IllegalArgumentException("Unknown service name: 
" + serviceName));
     
DockerClientFactory.instance().client().pauseContainerCmd(container.getContainerId()).exec();
   }
@@ -240,7 +240,7 @@ public class DockerComposeRule extends ExternalResource {
    * @param serviceName the service to unpause
    */
   public void unpauseService(String serviceName) {
-    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "_1")
+    ContainerState container = 
composeContainer.getContainerByServiceName(serviceName + "-1")
         .orElseThrow(() -> new IllegalArgumentException("Unknown service name: 
" + serviceName));
     
DockerClientFactory.instance().client().unpauseContainerCmd(container.getContainerId()).exec();
   }

Reply via email to