pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] aahmed-se commented on a change in pull request #2101: [WIP] Migrate compaction test to testcontainers
Date Thu, 12 Jul 2018 05:24:40 GMT
aahmed-se commented on a change in pull request #2101: [WIP] Migrate compaction test to testcontainers
URL: https://github.com/apache/incubator-pulsar/pull/2101#discussion_r201912576
 
 

 ##########
 File path: tests/integration/compaction/src/test/java/org/apache/pulsar/tests/integration/TestCompaction.java
 ##########
 @@ -18,52 +18,44 @@
  */
 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.PulsarClusterSpec;
+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 java.util.stream.Stream;
+
+import static java.util.stream.Collectors.joining;
+
+public class TestCompaction extends PulsarClusterTestBase {
 
-    @ArquillianResource
-    DockerClient docker;
+    @BeforeClass
+    public void setupCluster() throws Exception {
+        PulsarClusterSpec spec = PulsarClusterSpec.builder()
+            .clusterName(Stream.of(this.getClass().getSimpleName(), randomName(5))
+                .filter(s -> s != null && !s.isEmpty())
+                .collect(joining("-")))
+            .build();
 
-    @BeforeMethod
-    public void waitServicesUp() throws Exception {
-        Assert.assertTrue(PulsarClusterUtils.waitZooKeeperUp(docker, clusterName, 30, TimeUnit.SECONDS));
-        Assert.assertTrue(PulsarClusterUtils.waitAllBrokersUp(docker, clusterName));
+        super.setupCluster(spec);
     }
 
-    @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";
+    private static String clusterName = "test";
+
+    @Test(dataProvider = "ServiceUrls")
+    public void testPublishCompactAndConsumeCLI(String serviceUrl) throws Exception {
+
+        this.createTenantName("compaction-test-cli", clusterName, "admin");
 
 Review comment:
   done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message