sijie commented on a change in pull request #2504: Add Presto Sql Test
URL: https://github.com/apache/incubator-pulsar/pull/2504#discussion_r219043885
 
 

 ##########
 File path: 
tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestBasicPresto.java
 ##########
 @@ -0,0 +1,66 @@
+package org.apache.pulsar.tests.integration.presto;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.pulsar.tests.integration.docker.ContainerExecResult;
+import org.apache.pulsar.tests.integration.topologies.PulsarCluster;
+import org.apache.pulsar.tests.integration.topologies.PulsarClusterSpec;
+import org.apache.pulsar.tests.integration.topologies.PulsarClusterTestBase;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.joining;
+import static org.assertj.core.api.Assertions.assertThat;
+
+@Slf4j
+public class TestBasicPresto extends PulsarClusterTestBase {
+
+    @BeforeSuite
+    @Override
+    public void setupCluster() throws Exception {
+        final String clusterName = Stream.of(this.getClass().getSimpleName(), 
randomName(5))
+                .filter(s -> s != null && !s.isEmpty())
+                .collect(joining("-"));
+
+        PulsarClusterSpec spec = PulsarClusterSpec.builder()
+                .numBookies(2)
+                .numBrokers(1)
+                .enablePrestoWorker(true)
+                .clusterName(clusterName)
+                .build();
+
+        log.info("Setting up cluster {} with {} bookies, {} brokers",
+                spec.clusterName(), spec.numBookies(), spec.numBrokers());
+
+        pulsarCluster = PulsarCluster.forSpec(spec);
+        pulsarCluster.start();
+
+        log.info("Cluster {} is setup with presto worker", spec.clusterName());
+    }
+
+    @Test
+    public void testDefaultCatalog() throws Exception {
+        ContainerExecResult containerExecResult = execQuery("show catalogs;");
+        assertThat(containerExecResult.getExitCode()).isEqualTo(0);
+        assertThat(containerExecResult.getStdout()).contains("pulsar", 
"system");
+    }
+
+    @AfterSuite
+    @Override
+    public void tearDownCluster() {
+        super.tearDownCluster();
+    }
+
+    public static ContainerExecResult execQuery(final String query) throws 
Exception {
+        ContainerExecResult containerExecResult;
+
+        containerExecResult = pulsarCluster.getPrestoWorkerContainer()
 
 Review comment:
   can you test actual SQL query rather than just show catelog, which doesn't 
actually run any sql execution.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to