merlimat closed pull request #1399: Integration smoke test for pulsar
URL: https://github.com/apache/incubator-pulsar/pull/1399
 
 
   

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/pom.xml b/tests/integration/pom.xml
new file mode 100644
index 0000000000..a2e36d4556
--- /dev/null
+++ b/tests/integration/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.pulsar.tests</groupId>
+    <artifactId>tests-parent</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.pulsar.tests</groupId>
+  <artifactId>integration</artifactId>
+  <name>Apache Pulsar :: Tests :: Integration</name>
+  <modules>
+    <module>smoke</module>
+  </modules>
+</project>
diff --git a/tests/integration/smoke/pom.xml b/tests/integration/smoke/pom.xml
new file mode 100644
index 0000000000..eb3d49911d
--- /dev/null
+++ b/tests/integration/smoke/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="
+  http://maven.apache.org/POM/4.0.0
+  http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.pulsar.tests</groupId>
+    <artifactId>integration-tests-base</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+    <relativePath>../../integration-tests-base</relativePath>
+  </parent>
+
+  <groupId>org.apache.pulsar.tests.integration</groupId>
+  <artifactId>smoke</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache Pulsar :: Tests :: Integration Tests :: Smoke test</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.pulsar</groupId>
+      <artifactId>pulsar-client</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/tests/integration/smoke/src/test/java/org/apache/pulsar/tests/integration/TestSmoke.java
 
b/tests/integration/smoke/src/test/java/org/apache/pulsar/tests/integration/TestSmoke.java
new file mode 100644
index 0000000000..6ecd0536ad
--- /dev/null
+++ 
b/tests/integration/smoke/src/test/java/org/apache/pulsar/tests/integration/TestSmoke.java
@@ -0,0 +1,98 @@
+/**
+ * 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.
+ */
+/*
+* 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;
+
+import com.github.dockerjava.api.DockerClient;
+
+import org.apache.pulsar.client.api.Consumer;
+import org.apache.pulsar.client.api.Message;
+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.testng.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestSmoke extends Arquillian {
+    private static final Logger LOG = LoggerFactory.getLogger(TestSmoke.class);
+    private static byte[] PASSWD = "foobar".getBytes();
+    private static String clusterName = "test";
+
+    @ArquillianResource
+    DockerClient docker;
+
+    @Test
+    public void testPublishAndConsume() throws Exception {
+        Assert.assertTrue(PulsarClusterUtils.startAllBrokers(docker, 
clusterName));
+        Assert.assertTrue(PulsarClusterUtils.startAllProxies(docker, 
clusterName));
+
+        // create property and namespace
+        PulsarClusterUtils.runOnAnyBroker(docker, clusterName,
+                "/pulsar/bin/pulsar-admin", "properties",
+                "create", "smoke-test", "--allowed-clusters", clusterName,
+                "--admin-roles", "smoke-admin");
+        PulsarClusterUtils.runOnAnyBroker(docker, clusterName,
+                "/pulsar/bin/pulsar-admin", "namespaces",
+                "create", "smoke-test/test/ns1");
+
+        String brokerIp = DockerUtils.getContainerIP(
+                docker, PulsarClusterUtils.proxySet(docker, 
clusterName).stream().findAny().get());
+        String serviceUrl = "pulsar://" + brokerIp + ":6650";
+        String topic = "persistent://smoke-test/test/ns1/topic1";
+
+        try(PulsarClient client = PulsarClient.create(serviceUrl);
+            Consumer consumer = client.subscribe(topic, "my-sub");
+            Producer producer = client.createProducer(topic)) {
+            for (int i = 0; i < 10; i++) {
+                producer.send(("smoke-message"+i).getBytes());
+            }
+            for (int i = 0; i < 10; i++) {
+                Message m = consumer.receive();
+                Assert.assertEquals("smoke-message"+i, new 
String(m.getData()));
+            }
+        }
+
+        PulsarClusterUtils.stopAllProxies(docker, clusterName);
+        Assert.assertTrue(PulsarClusterUtils.stopAllBrokers(docker, 
clusterName));
+    }
+}
diff --git a/tests/integration/smoke/src/test/resources/arquillian.xml 
b/tests/integration/smoke/src/test/resources/arquillian.xml
new file mode 100644
index 0000000000..ced9de13b6
--- /dev/null
+++ b/tests/integration/smoke/src/test/resources/arquillian.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+
+    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.
+
+-->
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            xmlns="http://jboss.org/schema/arquillian";
+            xsi:schemaLocation="http://jboss.org/schema/arquillian
+                                
http://jboss.org/schema/arquillian/arquillian_1_0.xsd";>
+
+  <extension qualifier="docker">
+    <property name="definitionFormat">CUBE</property>
+    <property 
name="dockerContainersResource">cube-definitions/single-cluster-3-bookie-2-broker-unstarted.yaml</property>
+  </extension>
+
+</arquillian>
diff --git a/tests/pom.xml b/tests/pom.xml
index d4d3137709..a35a0f0f42 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -36,6 +36,7 @@
     <module>integration-tests-utils</module>
     <module>integration-tests-topologies</module>
     <module>integration-tests-base</module>
+    <module>integration</module>
   </modules>
   <build>
     <plugins>


 

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