sijie commented on a change in pull request #2101: Migrate compaction and s3 
offload test to testcontainers
URL: https://github.com/apache/incubator-pulsar/pull/2101#discussion_r202106974
 
 

 ##########
 File path: 
tests/integration/compaction/src/test/java/org/apache/pulsar/tests/integration/TestCompaction.java
 ##########
 @@ -18,63 +18,47 @@
  */
 package org.apache.pulsar.tests.integration;
 
-import com.github.dockerjava.api.DockerClient;
-
-import java.util.concurrent.TimeUnit;
-
 import org.apache.pulsar.client.api.Consumer;
 import org.apache.pulsar.client.api.Message;
 import org.apache.pulsar.client.api.MessageBuilder;
-import org.apache.pulsar.client.api.MessageRoutingMode;
 import org.apache.pulsar.client.api.Producer;
 import org.apache.pulsar.client.api.PulsarClient;
-import org.apache.pulsar.tests.DockerUtils;
-import org.apache.pulsar.tests.PulsarClusterUtils;
-import org.jboss.arquillian.test.api.ArquillianResource;
-import org.jboss.arquillian.testng.Arquillian;
+import org.apache.pulsar.tests.topologies.PulsarClusterTestBase;
+import org.testcontainers.containers.Container;
 import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-public class TestCompaction extends Arquillian {
-    private static String clusterName = "test";
+import static java.util.stream.Collectors.joining;
 
-    @ArquillianResource
-    DockerClient docker;
+public class TestCompaction extends PulsarClusterTestBase {
 
-    @BeforeMethod
-    public void waitServicesUp() throws Exception {
-        Assert.assertTrue(PulsarClusterUtils.waitZooKeeperUp(docker, 
clusterName, 30, TimeUnit.SECONDS));
-        Assert.assertTrue(PulsarClusterUtils.waitAllBrokersUp(docker, 
clusterName));
+    @BeforeClass
+    @Override
+    public void setupCluster() throws Exception {
+        super.setupClusterNoWorker();
     }
 
-    @Test
-    public void testPublishCompactAndConsumeCLI() throws Exception {
-        PulsarClusterUtils.runOnAnyBroker(docker, clusterName,
-                                          PulsarClusterUtils.PULSAR_ADMIN, 
"tenants",
-                                          "create", "compaction-test-cli", 
"--allowed-clusters", clusterName,
-                                          "--admin-roles", "admin");
-        PulsarClusterUtils.runOnAnyBroker(docker, clusterName,
-                PulsarClusterUtils.PULSAR_ADMIN, "namespaces",
-                "create", "compaction-test-cli/ns1");
-        PulsarClusterUtils.runOnAnyBroker(docker, clusterName,
-                PulsarClusterUtils.PULSAR_ADMIN, "namespaces",
-                "set-clusters", "--clusters", "test", 
"compaction-test-cli/ns1");
-
-        String brokerIp = DockerUtils.getContainerIP(
-                docker, PulsarClusterUtils.proxySet(docker, 
clusterName).stream().findAny().get());
-        String serviceUrl = "pulsar://" + brokerIp + ":6650";
-        String topic = "persistent://compaction-test-cli/ns1/topic1";
+    @Test(dataProvider = "ServiceUrls")
+    public void testPublishCompactAndConsumeCLI(String serviceUrl) throws 
Exception {
+
+        final String TENANT = "compaction-test-cli-" + randomName(4);
 
 Review comment:
   nit: upper cases are used for CONSTANT. these variables here are not 
constants. prefer using lower cases.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to