From 6b65c9df461968d0a12b8861c9a03aa7eae12cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Wed, 22 Jun 2022 15:17:43 +0200 Subject: [PATCH] [improve][test] Upgrade testcontainers to 1.17.2 (#16161) * [improve][test] Upgrade testcontainers to 1.17.2 * migrate getContainerIpAddress to getHost * fix compile * remove usage of shaded lib from testcontainers (cherry picked from commit c8f03e8f532a54ca9d7f180b9046ea47e29b0178) --- pom.xml | 4 ++-- .../apache/pulsar/tests/integration/PulsarContainer.java | 2 +- .../apache/pulsar/tests/integration/PulsarContainer.java | 2 +- .../apache/pulsar/tests/integration/PulsarContainer.java | 2 +- .../tests/integration/cli/FileSystemPackagesCliTest.java | 2 +- .../pulsar/tests/integration/cli/PackagesCliTest.java | 2 +- .../pulsar/tests/integration/cli/PulsarVersionTest.java | 2 +- .../tests/integration/containers/PrestoWorkerContainer.java | 2 +- .../pulsar/tests/integration/containers/ProxyContainer.java | 4 ++-- .../tests/integration/containers/StandaloneContainer.java | 4 ++-- .../pulsar/tests/integration/io/RabbitMQSinkTester.java | 2 +- .../integration/presto/TestPrestoQueryTieredStorage.java | 2 +- .../pulsar/tests/integration/presto/TestPulsarSQLBase.java | 6 +++--- .../pulsar/tests/integration/topologies/PulsarCluster.java | 6 +++--- .../apache/pulsar/tests/integration/PulsarContainer.java | 4 ++-- .../apache/pulsar/tests/integration/PulsarContainer.java | 4 ++-- .../apache/pulsar/tests/integration/PulsarContainer.java | 4 ++-- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index cd9766107e6d4..107663378c7d9 100644 --- a/pom.xml +++ b/pom.xml @@ -219,11 +219,11 @@ flexible messaging model and an intuitive client API. 3.6.0 3.4.0 - 1.15.3 + 1.17.2 2.2 - 3.2.8 + 3.2.13 1.1.1 7.3.0 4.13.1 diff --git a/tests/bc_2_0_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/bc_2_0_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index 446074c0d77e8..349c3f1daa58d 100644 --- a/tests/bc_2_0_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/bc_2_0_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,7 +48,7 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } } diff --git a/tests/bc_2_0_1/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/bc_2_0_1/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index 446074c0d77e8..349c3f1daa58d 100644 --- a/tests/bc_2_0_1/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/bc_2_0_1/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,7 +48,7 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } } diff --git a/tests/bc_2_6_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/bc_2_6_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index 446074c0d77e8..349c3f1daa58d 100644 --- a/tests/bc_2_6_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/bc_2_6_0/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,7 +48,7 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/FileSystemPackagesCliTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/FileSystemPackagesCliTest.java index a9aa38cc9eb2c..08f5e50a2d9d9 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/FileSystemPackagesCliTest.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/FileSystemPackagesCliTest.java @@ -18,12 +18,12 @@ */ package org.apache.pulsar.tests.integration.cli; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.pulsar.tests.TestRetrySupport; import org.apache.pulsar.tests.integration.containers.BrokerContainer; import org.apache.pulsar.tests.integration.docker.ContainerExecResult; import org.apache.pulsar.tests.integration.topologies.PulsarCluster; import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec; -import org.testcontainers.shaded.org.apache.commons.lang.RandomStringUtils; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PackagesCliTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PackagesCliTest.java index f6e5db7a6c101..2ed201d6c2ffb 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PackagesCliTest.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PackagesCliTest.java @@ -18,12 +18,12 @@ */ package org.apache.pulsar.tests.integration.cli; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.pulsar.tests.TestRetrySupport; import org.apache.pulsar.tests.integration.containers.BrokerContainer; import org.apache.pulsar.tests.integration.docker.ContainerExecResult; import org.apache.pulsar.tests.integration.topologies.PulsarCluster; import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec; -import org.testcontainers.shaded.org.apache.commons.lang.RandomStringUtils; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PulsarVersionTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PulsarVersionTest.java index 0d7d4f3e073b6..c5a785e3e7fff 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PulsarVersionTest.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/cli/PulsarVersionTest.java @@ -18,11 +18,11 @@ */ package org.apache.pulsar.tests.integration.cli; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.pulsar.tests.TestRetrySupport; import org.apache.pulsar.tests.integration.docker.ContainerExecResult; import org.apache.pulsar.tests.integration.topologies.PulsarCluster; import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec; -import org.testcontainers.shaded.org.apache.commons.lang.RandomStringUtils; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java index 0105cd8392677..2bb696580f09a 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java @@ -63,6 +63,6 @@ protected void beforeStop() { } public String getUrl() { - return String.format("%s:%s", getContainerIpAddress(), getMappedPort(PrestoWorkerContainer.PRESTO_HTTP_PORT)); + return String.format("%s:%s", getHost(), getMappedPort(PrestoWorkerContainer.PRESTO_HTTP_PORT)); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ProxyContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ProxyContainer.java index 71a464b243f40..176943a06e9e6 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ProxyContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/ProxyContainer.java @@ -31,10 +31,10 @@ public ProxyContainer(String clusterName, String hostName) { } public String getPlainTextServiceUrl() { - return "pulsar://" + getContainerIpAddress() + ":" + getMappedPort(BROKER_PORT); + return "pulsar://" + getHost() + ":" + getMappedPort(BROKER_PORT); } public String getHttpServiceUrl() { - return "http://" + getContainerIpAddress() + ":" + getMappedPort(BROKER_HTTP_PORT); + return "http://" + getHost() + ":" + getMappedPort(BROKER_HTTP_PORT); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/StandaloneContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/StandaloneContainer.java index 819e3286a8345..0bdea9cb45f7e 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/StandaloneContainer.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/StandaloneContainer.java @@ -68,10 +68,10 @@ protected void beforeStart() { } public String getPlainTextServiceUrl() { - return "pulsar://" + getContainerIpAddress() + ":" + getMappedPort(BROKER_PORT); + return "pulsar://" + getHost() + ":" + getMappedPort(BROKER_PORT); } public String getHttpServiceUrl() { - return "http://" + getContainerIpAddress() + ":" + getMappedPort(BROKER_HTTP_PORT); + return "http://" + getHost() + ":" + getMappedPort(BROKER_HTTP_PORT); } } diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/RabbitMQSinkTester.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/RabbitMQSinkTester.java index 3b698dc22d118..4b47c8caf3e55 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/RabbitMQSinkTester.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/RabbitMQSinkTester.java @@ -66,7 +66,7 @@ public void prepareSink() throws Exception { static ConnectionFactory createConnectionFactory(RabbitMQContainer container) { ConnectionFactory connectionFactory = new ConnectionFactory(); - connectionFactory.setHost(container.getContainerIpAddress()); + connectionFactory.setHost(container.getHost()); connectionFactory.setPort(container.getMappedPort(RabbitMQContainer.PORTS[0])); return connectionFactory; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPrestoQueryTieredStorage.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPrestoQueryTieredStorage.java index 2d3e96a8c3e60..c7a2f5b767269 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPrestoQueryTieredStorage.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPrestoQueryTieredStorage.java @@ -25,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.bookkeeper.client.BookKeeper; import org.apache.bookkeeper.conf.ClientConfiguration; +import org.apache.commons.lang3.StringUtils; import org.apache.pulsar.client.admin.PulsarAdmin; import org.apache.pulsar.client.api.CompressionType; import org.apache.pulsar.client.api.Consumer; @@ -37,7 +38,6 @@ import org.apache.pulsar.common.naming.TopicDomain; import org.apache.pulsar.common.naming.TopicName; import org.apache.pulsar.tests.integration.containers.S3Container; -import org.testcontainers.shaded.org.apache.commons.lang.StringUtils; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPulsarSQLBase.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPulsarSQLBase.java index 0626e3522e8c5..52a0d2c0cde84 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPulsarSQLBase.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestPulsarSQLBase.java @@ -30,6 +30,9 @@ import java.util.List; import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import org.apache.pulsar.client.api.CompressionType; import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.common.naming.TopicName; @@ -39,9 +42,6 @@ import org.apache.pulsar.tests.integration.suites.PulsarSQLTestSuite; import org.apache.pulsar.tests.integration.topologies.PulsarCluster; import org.awaitility.Awaitility; -import org.testcontainers.shaded.okhttp3.OkHttpClient; -import org.testcontainers.shaded.okhttp3.Request; -import org.testcontainers.shaded.okhttp3.Response; import org.testng.Assert; import org.testng.annotations.DataProvider; diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java index dc2ecd42a64ed..3a5e650178e4f 100644 --- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java +++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarCluster.java @@ -216,7 +216,7 @@ public String getAllBrokersHttpServiceUrl() { Iterator brokers = getBrokers().iterator(); while (brokers.hasNext()) { BrokerContainer broker = brokers.next(); - multiUrl += broker.getContainerIpAddress() + ":" + broker.getMappedPort(BROKER_HTTP_PORT); + multiUrl += broker.getHost() + ":" + broker.getMappedPort(BROKER_HTTP_PORT); if (brokers.hasNext()) { multiUrl += ","; } @@ -225,11 +225,11 @@ public String getAllBrokersHttpServiceUrl() { } public String getZKConnString() { - return zkContainer.getContainerIpAddress() + ":" + zkContainer.getMappedPort(ZK_PORT); + return zkContainer.getHost() + ":" + zkContainer.getMappedPort(ZK_PORT); } public String getCSConnString() { - return csContainer.getContainerIpAddress() + ":" + csContainer.getMappedPort(CS_PORT); + return csContainer.getHost() + ":" + csContainer.getMappedPort(CS_PORT); } public Network getNetwork() { diff --git a/tests/pulsar-client-admin-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/pulsar-client-admin-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index f742a704c1b38..4220415ba6149 100644 --- a/tests/pulsar-client-admin-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/pulsar-client-admin-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,11 +48,11 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } public String getPulsarAdminUrl() { - return String.format("http://%s:%s", this.getContainerIpAddress(), this.getMappedPort(BROKER_HTTP_PORT)); + return String.format("http://%s:%s", this.getHost(), this.getMappedPort(BROKER_HTTP_PORT)); } } diff --git a/tests/pulsar-client-all-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/pulsar-client-all-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index f742a704c1b38..4220415ba6149 100644 --- a/tests/pulsar-client-all-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/pulsar-client-all-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,11 +48,11 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } public String getPulsarAdminUrl() { - return String.format("http://%s:%s", this.getContainerIpAddress(), this.getMappedPort(BROKER_HTTP_PORT)); + return String.format("http://%s:%s", this.getHost(), this.getMappedPort(BROKER_HTTP_PORT)); } } diff --git a/tests/pulsar-client-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java b/tests/pulsar-client-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java index f742a704c1b38..4220415ba6149 100644 --- a/tests/pulsar-client-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java +++ b/tests/pulsar-client-shade-test/src/test/java/org/apache/pulsar/tests/integration/PulsarContainer.java @@ -48,11 +48,11 @@ public PulsarContainer(final String pulsarVersion) { } public String getPlainTextPulsarBrokerUrl() { - return String.format("pulsar://%s:%s", this.getContainerIpAddress(), this.getMappedPort(PULSAR_PORT)); + return String.format("pulsar://%s:%s", this.getHost(), this.getMappedPort(PULSAR_PORT)); } public String getPulsarAdminUrl() { - return String.format("http://%s:%s", this.getContainerIpAddress(), this.getMappedPort(BROKER_HTTP_PORT)); + return String.format("http://%s:%s", this.getHost(), this.getMappedPort(BROKER_HTTP_PORT)); } }