aahmed-se 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_r202441103
 
 

 ##########
 File path: 
tests/integration/s3-offload/src/test/java/org/apache/pulsar/tests/integration/TestS3Offload.java
 ##########
 @@ -33,58 +34,58 @@
 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.containers.BrokerContainer;
+import org.apache.pulsar.tests.containers.S3Container;
+import org.apache.pulsar.tests.topologies.PulsarCluster;
+import org.apache.pulsar.tests.topologies.PulsarClusterSpec;
+import org.apache.pulsar.tests.topologies.PulsarClusterTestBase;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-public class TestS3Offload extends Arquillian {
-    private static final Logger log = 
LoggerFactory.getLogger(TestS3Offload.class);
+import static java.util.stream.Collectors.joining;
+
+@Slf4j
+public class TestS3Offload extends PulsarClusterTestBase {
 
-    private static final String CLUSTER_NAME = "test";
     private static final int ENTRY_SIZE = 1024;
     private static final int ENTRIES_PER_LEDGER = 1024;
 
-    @ArquillianResource
-    DockerClient docker;
-
-    @BeforeMethod
-    public void configureAndStartBrokers() throws Exception {
-
-        String s3ip = DockerUtils.cubeIdsWithLabels(
-                docker, ImmutableMap.of("service", "s3", "cluster", 
CLUSTER_NAME))
-            .stream().map((c) -> DockerUtils.getContainerIP(docker, 
c)).findFirst().get();
-
-        String brokerConfFile = "/pulsar/conf/broker.conf";
-        for (String b : PulsarClusterUtils.brokerSet(docker, CLUSTER_NAME)) {
-            PulsarClusterUtils.updateConf(docker, b, brokerConfFile,
-                    "managedLedgerMaxEntriesPerLedger", 
String.valueOf(ENTRIES_PER_LEDGER));
-            PulsarClusterUtils.updateConf(docker, b, brokerConfFile,
-                    "managedLedgerMinLedgerRolloverTimeMinutes", "0");
-            PulsarClusterUtils.updateConf(docker, b, brokerConfFile,
-                    "managedLedgerOffloadDriver", "s3");
-            PulsarClusterUtils.updateConf(docker, b, brokerConfFile,
-                    "s3ManagedLedgerOffloadBucket", "pulsar-integtest");
-            PulsarClusterUtils.updateConf(docker, b, brokerConfFile,
-                    "s3ManagedLedgerOffloadServiceEndpoint", "http://"; + s3ip 
+ ":9090");
+    @Override
+    @BeforeClass
+    public void setupCluster() throws Exception {
+        PulsarClusterSpec spec = PulsarClusterSpec.builder()
+            .numBookies(2)
+            .numBrokers(1)
+            .enableTieredStorage(true)
+            .clusterName(Stream.of(this.getClass().getSimpleName(), 
randomName(5))
+                .filter(s -> s != null && !s.isEmpty())
+                .collect(joining("-")))
+            .build();
+
+        log.info("Setting up cluster {} with {} bookies, {} brokers",
+                spec.clusterName(), spec.numBookies(), spec.numBrokers());
+
+        pulsarCluster = PulsarCluster.forSpec(spec);
+
+        for(BrokerContainer brokerContainer : pulsarCluster.getBrokers()){
+            brokerContainer.withEnv("managedLedgerMaxEntriesPerLedger", 
String.valueOf(ENTRIES_PER_LEDGER));
 
 Review comment:
   part of larger future change for pulsarclusterspec, out of scope here.

----------------------------------------------------------------
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