pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjee...@apache.org
Subject [pulsar] branch master updated: Add BC Testing sample smoke test (#3355)
Date Fri, 11 Jan 2019 01:29:59 GMT
This is an automated email from the ASF dual-hosted git repository.

sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b8bd04  Add BC Testing sample smoke test (#3355)
4b8bd04 is described below

commit 4b8bd04f3571f4c6dc40d0b1a1e79975d9ad5408
Author: Ali Ahmed <alahmed.se@gmail.com>
AuthorDate: Thu Jan 10 17:29:55 2019 -0800

    Add BC Testing sample smoke test (#3355)
---
 .../PulsarStandaloneTestSuite2_2.java}             |  8 ++++----
 .../SmokeTest2_2.java}                             |  7 +++----
 .../integration/containers/PulsarContainer.java    | 24 ++++++++++++++++++++--
 .../containers/StandaloneContainer.java            | 11 ++++++++++
 .../tests/integration/standalone/SmokeTest.java    |  1 -
 .../suites/PulsarStandaloneTestSuite.java          |  4 ++--
 .../integration/topologies/PulsarCluster.java      |  6 +++---
 .../integration/topologies/PulsarClusterSpec.java  | 14 ++++++++++---
 .../topologies/PulsarStandaloneTestBase.java       |  4 ++--
 9 files changed, 58 insertions(+), 21 deletions(-)

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/backwardscompatibility/PulsarStandaloneTestSuite2_2.java
similarity index 81%
copy from tests/integration/src/test/java/org/apache/pulsar/tests/integration/suites/PulsarStandaloneTestSuite.java
copy to tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/PulsarStandaloneTestSuite2_2.java
index 15e82e3..db993f3 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/backwardscompatibility/PulsarStandaloneTestSuite2_2.java
@@ -16,18 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pulsar.tests.integration.suites;
+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 PulsarStandaloneTestSuite extends PulsarStandaloneTestBase implements ITest
{
+public class PulsarStandaloneTestSuite2_2 extends PulsarStandaloneTestBase implements ITest
{
 
     @BeforeSuite
     public void setUpCluster() throws Exception {
-        super.startCluster();
+        super.startCluster(PulsarContainer.PULSAR_2_2_IMAGE_NAME);
     }
 
     @AfterSuite
@@ -35,7 +36,6 @@ public class PulsarStandaloneTestSuite extends PulsarStandaloneTestBase
implemen
         super.stopCluster();
     }
 
-
     @Override
     public String getTestName() {
         return "pulsar-standalone-suite";
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/backwardscompatibility/SmokeTest2_2.java
similarity index 84%
copy from tests/integration/src/test/java/org/apache/pulsar/tests/integration/standalone/SmokeTest.java
copy to tests/integration/src/test/java/org/apache/pulsar/tests/integration/backwardscompatibility/SmokeTest2_2.java
index 2b658fa..d9c446d 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/backwardscompatibility/SmokeTest2_2.java
@@ -16,13 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pulsar.tests.integration.standalone;
 
-import org.apache.pulsar.tests.integration.suites.PulsarStandaloneTestSuite;
-import org.testng.annotations.Test;
+package org.apache.pulsar.tests.integration.backwardscompatibility;
 
+import org.testng.annotations.Test;
 
-public class SmokeTest extends PulsarStandaloneTestSuite {
+public class SmokeTest2_2 extends PulsarStandaloneTestSuite2_2 {
 
     @Test(dataProvider = "StandaloneServiceUrlAndTopics")
     public void testPublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception
{
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 7650d8f..59e8628 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 abstract class PulsarContainer<SelfT extends PulsarContainer<SelfT>>
exte
     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 abstract class PulsarContainer<SelfT extends PulsarContainer<SelfT>>
exte
                            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 60a5748..cc47d44 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 class StandaloneContainer extends PulsarContainer<StandaloneContainer>
{
             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 2b658fa..97c07ff 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 @@ package org.apache.pulsar.tests.integration.standalone;
 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 15e82e3..4e2e601 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 @@ public class PulsarStandaloneTestSuite extends PulsarStandaloneTestBase
implemen
 
     @BeforeSuite
     public void setUpCluster() throws Exception {
-        super.startCluster();
+        super.startCluster(PulsarContainer.DEFAULT_IMAGE_NAME);
     }
 
     @AfterSuite
@@ -35,7 +36,6 @@ public class PulsarStandaloneTestSuite extends PulsarStandaloneTestBase
implemen
         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 803bde7..7c99de2 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 class PulsarCluster {
 
         // 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 @@ public class PulsarCluster {
     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 3aeb6c6..36110d2 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.Getter;
 import lombok.Setter;
 import lombok.experimental.Accessors;
 
+import org.apache.pulsar.tests.integration.containers.PulsarContainer;
 import org.testcontainers.containers.GenericContainer;
 
 /**
@@ -78,11 +79,10 @@ public class PulsarClusterSpec {
     @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 @@ public class PulsarClusterSpec {
      */
     @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 40be9ba..46a6c0d 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 @@ public abstract class PulsarStandaloneTestBase extends PulsarTestBase
{
     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();


Mime
View raw message