You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/01/11 01:29:57 UTC

[GitHub] srkukarni closed pull request #3355: Add BC Testing sample smoke test

srkukarni closed pull request #3355: Add BC Testing sample smoke test
URL: https://github.com/apache/pulsar/pull/3355
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/PulsarStandaloneTestSuite2_2.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/PulsarStandaloneTestSuite2_2.java
new file mode 100644
index 0000000000..db993f3190
--- /dev/null
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/PulsarStandaloneTestSuite2_2.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.tests.integration.backwardscompatibility;
+
+import org.apache.pulsar.tests.integration.containers.PulsarContainer;
+import org.apache.pulsar.tests.integration.topologies.PulsarStandaloneTestBase;
+import org.testng.ITest;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+
+public class PulsarStandaloneTestSuite2_2 extends PulsarStandaloneTestBase implements ITest {
+
+    @BeforeSuite
+    public void setUpCluster() throws Exception {
+        super.startCluster(PulsarContainer.PULSAR_2_2_IMAGE_NAME);
+    }
+
+    @AfterSuite
+    public void tearDownCluster() throws Exception {
+        super.stopCluster();
+    }
+
+    @Override
+    public String getTestName() {
+        return "pulsar-standalone-suite";
+    }
+}
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/SmokeTest2_2.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/SmokeTest2_2.java
new file mode 100644
index 0000000000..d9c446d3bc
--- /dev/null
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/SmokeTest2_2.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.pulsar.tests.integration.backwardscompatibility;
+
+import org.testng.annotations.Test;
+
+public class SmokeTest2_2 extends PulsarStandaloneTestSuite2_2 {
+
+    @Test(dataProvider = "StandaloneServiceUrlAndTopics")
+    public void testPublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception {
+        super.testPublishAndConsume(serviceUrl, isPersistent);
+    }
+
+}
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java
index 7650d8feff..59e86287f3 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PulsarContainer.java
@@ -40,7 +40,10 @@
     public static final int BROKER_PORT = 6650;
     public static final int BROKER_HTTP_PORT = 8080;
 
-    private static final String IMAGE_NAME = "apachepulsar/pulsar-test-latest-version:latest";
+    public static final String DEFAULT_IMAGE_NAME = "apachepulsar/pulsar-test-latest-version:latest";
+    public static final String PULSAR_2_2_IMAGE_NAME = "apachepulsar/pulsar:2.2.0";
+    public static final String PULSAR_2_1_IMAGE_NAME = "apachepulsar/pulsar:2.1.0";
+    public static final String PULSAR_2_0_IMAGE_NAME = "apachepulsar/pulsar:2.0.0";
 
     private final String hostname;
     private final String serviceName;
@@ -65,7 +68,24 @@ public PulsarContainer(String clusterName,
                            int servicePort,
                            int httpPort,
                            String httpPath) {
-        super(clusterName, IMAGE_NAME);
+        super(clusterName, DEFAULT_IMAGE_NAME);
+        this.hostname = hostname;
+        this.serviceName = serviceName;
+        this.serviceEntryPoint = serviceEntryPoint;
+        this.servicePort = servicePort;
+        this.httpPort = httpPort;
+        this.httpPath = httpPath;
+    }
+
+    public PulsarContainer(String clusterName,
+                           String hostname,
+                           String serviceName,
+                           String serviceEntryPoint,
+                           int servicePort,
+                           int httpPort,
+                           String httpPath,
+                           String pulsarImageName) {
+        super(clusterName, pulsarImageName);
         this.hostname = hostname;
         this.serviceName = serviceName;
         this.serviceEntryPoint = serviceEntryPoint;
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 60a574861d..cc47d44e1b 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
@@ -39,6 +39,17 @@ public StandaloneContainer(String clusterName) {
             BROKER_HTTP_PORT);
     }
 
+    public StandaloneContainer(String clusterName, String pulsarImageName) {
+        super(clusterName,
+                NAME,
+                NAME + "-cluster",
+                "bin/pulsar",
+                BROKER_PORT,
+                BROKER_HTTP_PORT,
+                "",
+                pulsarImageName);
+    }
+
     @Override
     protected void configure() {
         super.configure();
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/standalone/SmokeTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/standalone/SmokeTest.java
index 2b658fa97a..97c07ff9cb 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/standalone/SmokeTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/standalone/SmokeTest.java
@@ -21,7 +21,6 @@
 import org.apache.pulsar.tests.integration.suites.PulsarStandaloneTestSuite;
 import org.testng.annotations.Test;
 
-
 public class SmokeTest extends PulsarStandaloneTestSuite {
 
     @Test(dataProvider = "StandaloneServiceUrlAndTopics")
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarStandaloneTestSuite.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarStandaloneTestSuite.java
index 15e82e35ca..4e2e601218 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarStandaloneTestSuite.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarStandaloneTestSuite.java
@@ -18,6 +18,7 @@
  */
 package org.apache.pulsar.tests.integration.suites;
 
+import org.apache.pulsar.tests.integration.containers.PulsarContainer;
 import org.apache.pulsar.tests.integration.topologies.PulsarStandaloneTestBase;
 import org.testng.ITest;
 import org.testng.annotations.AfterSuite;
@@ -27,7 +28,7 @@
 
     @BeforeSuite
     public void setUpCluster() throws Exception {
-        super.startCluster();
+        super.startCluster(PulsarContainer.DEFAULT_IMAGE_NAME);
     }
 
     @AfterSuite
@@ -35,7 +36,6 @@ public void tearDownCluster() throws Exception {
         super.stopCluster();
     }
 
-
     @Override
     public String getTestName() {
         return "pulsar-standalone-suite";
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 803bde7ce9..7c99de2bf2 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
@@ -204,11 +204,11 @@ public void start() throws Exception {
 
         // start bookies
         bookieContainers.values().forEach(BKContainer::start);
-        log.info("Successfully started {} bookie conntainers.", bookieContainers.size());
+        log.info("Successfully started {} bookie containers.", bookieContainers.size());
 
         // start brokers
         this.startAllBrokers();
-        log.info("Successfully started {} broker conntainers.", brokerContainers.size());
+        log.info("Successfully started {} broker containers.", brokerContainers.size());
 
         // create proxy
         proxyContainer.start();
@@ -394,7 +394,7 @@ private void startFunctionWorkersWithThreadContainerFactory(String suffix, int n
     public synchronized void startWorkers() {
         // Start workers that have been initialized
         workerContainers.values().parallelStream().forEach(WorkerContainer::start);
-        log.info("Successfully started {} worker conntainers.", workerContainers.size());
+        log.info("Successfully started {} worker containers.", workerContainers.size());
     }
 
     public synchronized void stopWorkers() {
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarClusterSpec.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarClusterSpec.java
index 3aeb6c606c..36110d2a6e 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarClusterSpec.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarClusterSpec.java
@@ -28,6 +28,7 @@
 import lombok.Setter;
 import lombok.experimental.Accessors;
 
+import org.apache.pulsar.tests.integration.containers.PulsarContainer;
 import org.testcontainers.containers.GenericContainer;
 
 /**
@@ -78,11 +79,10 @@
     @Default
     int numFunctionWorkers = 0;
 
-
     /**
-     * Enable a Preto Worker Node
+     * Enable a Presto Worker Node
      *
-     * @return the flag whether presto worker is eanbled
+     * @return the flag whether presto worker is enabled
      */
     @Default
     boolean enablePrestoWorker = false;
@@ -116,4 +116,12 @@
      */
     @Builder.Default
     Map<String, String> classPathVolumeMounts = new TreeMap<>();
+
+    /**
+     * Pulsar Test Image Name
+     *
+     * @return the version of the pulsar test image to use
+     */
+    @Default
+    String pulsarTestImage = PulsarContainer.DEFAULT_IMAGE_NAME;
 }
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarStandaloneTestBase.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarStandaloneTestBase.java
index 40be9ba9e4..46a6c0dc6f 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarStandaloneTestBase.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarStandaloneTestBase.java
@@ -56,10 +56,10 @@
     protected static Network network;
     protected static StandaloneContainer container;
 
-    protected void startCluster() throws Exception {
+    protected void startCluster(final String pulsarImageName) throws Exception {
         network = Network.newNetwork();
         String clusterName = PulsarClusterTestBase.randomName(8);
-        container = new StandaloneContainer(clusterName)
+        container = new StandaloneContainer(clusterName, pulsarImageName)
             .withNetwork(network)
             .withNetworkAliases(StandaloneContainer.NAME + "-" + clusterName);
         container.start();


 

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