You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/03/19 15:24:22 UTC
[pulsar] branch master updated: copy logs from presto server
container on teardown in integration tests (#3859)
This is an automated email from the ASF dual-hosted git repository.
mmerli 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 6e0c11e copy logs from presto server container on teardown in integration tests (#3859)
6e0c11e is described below
commit 6e0c11e58f20333a24118cd30ad2c7f69a8b423b
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Tue Mar 19 08:24:15 2019 -0700
copy logs from presto server container on teardown in integration tests (#3859)
---
.../containers/PrestoWorkerContainer.java | 14 ++++++++
.../tests/integration/presto/TestBasicPresto.java | 39 +++++++++++-----------
2 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java
index edb0a0c..2dd4d4e 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/containers/PrestoWorkerContainer.java
@@ -18,6 +18,8 @@
*/
package org.apache.pulsar.tests.integration.containers;
+import org.apache.pulsar.tests.integration.utils.DockerUtils;
+
/**
* A pulsar container that runs the presto worker
*/
@@ -36,4 +38,16 @@ public class PrestoWorkerContainer extends PulsarContainer<PrestoWorkerContainer
PRESTO_HTTP_PORT,
"/v1/node");
}
+
+ @Override
+ protected void beforeStop() {
+ super.beforeStop();
+ if (null != containerId) {
+ DockerUtils.dumpContainerDirToTargetCompressed(
+ getDockerClient(),
+ containerId,
+ "/pulsar/lib/presto/var/log"
+ );
+ }
+ }
}
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestBasicPresto.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestBasicPresto.java
index 48cffb7..d759023 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestBasicPresto.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/presto/TestBasicPresto.java
@@ -42,28 +42,12 @@ public class TestBasicPresto extends PulsarTestSuite {
@BeforeClass
public void setupPresto() throws Exception {
pulsarCluster.startPrestoWorker();
-
- // wait until presto worker started
- ContainerExecResult result;
- do {
- try {
- result = execQuery("show catalogs;");
- assertThat(result.getExitCode()).isEqualTo(0);
- assertThat(result.getStdout()).contains("pulsar", "system");
- break;
- } catch (ContainerExecException cee) {
- if (cee.getResult().getStderr().contains("Presto server is still initializing")) {
- Thread.sleep(10000);
- } else {
- throw cee;
- }
- }
- } while (true);
}
@AfterClass
public void teardownPresto() {
- pulsarCluster.stopPrestoWorker();;
+ log.info("tearing down...");
+ pulsarCluster.stopPrestoWorker();
}
@Test
@@ -78,6 +62,23 @@ public class TestBasicPresto extends PulsarTestSuite {
public void testSimpleSQLQuery(boolean isBatched) throws Exception {
+ // wait until presto worker started
+ ContainerExecResult result;
+ do {
+ try {
+ result = execQuery("show catalogs;");
+ assertThat(result.getExitCode()).isEqualTo(0);
+ assertThat(result.getStdout()).contains("pulsar", "system");
+ break;
+ } catch (ContainerExecException cee) {
+ if (cee.getResult().getStderr().contains("Presto server is still initializing")) {
+ Thread.sleep(10000);
+ } else {
+ throw cee;
+ }
+ }
+ } while (true);
+
@Cleanup
PulsarClient pulsarClient = PulsarClient.builder()
.serviceUrl(pulsarCluster.getPlainTextServiceUrl())
@@ -96,7 +97,7 @@ public class TestBasicPresto extends PulsarTestSuite {
producer.send(stock);
}
- ContainerExecResult result = execQuery("show schemas in pulsar;");
+ result = execQuery("show schemas in pulsar;");
assertThat(result.getExitCode()).isEqualTo(0);
assertThat(result.getStdout()).contains("public/default");