Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BOOKKEEPER-522: TestHedwigHub is failing silently on Jenkins (ivank v…

…ia sijie)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk@1425586 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit a0ae97c232caafa1fda9955f9aaa9f99564b74fe 1 parent fa13426
@sijie sijie authored
View
2  CHANGES.txt
@@ -316,6 +316,8 @@ Trunk (unreleased changes)
BOOKKEEPER-342: add documentation for hedwig metadata manager interface. (sijie, ivank via sijie)
+ BOOKKEEPER-522: TestHedwigHub is failing silently on Jenkins (ivank via sijie)
+
hedwig-client:
BOOKKEEPER-306: Change C++ client to use gtest for testing (ivank via sijie)
View
2  bookkeeper-benchmark/pom.xml
@@ -43,9 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
<configuration>
- <argLine>-Xmx1G -Djava.net.preferIPv4Stack=true</argLine>
<systemPropertyVariables>
<test.latency.file>target/latencyDump.dat</test.latency.file>
</systemPropertyVariables>
View
9 bookkeeper-server/pom.xml
@@ -155,15 +155,6 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <argLine>-Xmx1G -Djava.net.preferIPv4Stack=true</argLine>
- <forkMode>pertest</forkMode>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
View
2  hedwig-server/pom.xml
@@ -233,9 +233,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
<configuration>
- <argLine>-Xmx1G -Djava.net.preferIPv4Stack=true</argLine>
<systemPropertyVariables>
<derby.stream.error.file>target/derby.log</derby.stream.error.file>
<build.test.dir>target/zk_clientbase_build</build.test.dir>
View
2  hedwig-server/src/test/java/org/apache/hedwig/server/HedwigHubTestBase.java
@@ -137,7 +137,7 @@ protected void startHubServers() throws Exception {
for (int i = 0; i < numServers; i++) {
ServerConfiguration conf = getServerConfiguration(serverAddresses.get(i).getPort(),
serverAddresses.get(i).getSSLPort());
- PubSubServer s = new PubSubServer(conf);
+ PubSubServer s = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
serversList.add(s);
s.start();
}
View
4 hedwig-server/src/test/java/org/apache/hedwig/server/HedwigRegionTestBase.java
@@ -35,6 +35,7 @@
import org.apache.hedwig.server.netty.PubSubServer;
import org.apache.hedwig.server.persistence.BookKeeperTestBase;
import org.apache.hedwig.util.HedwigSocketAddress;
+import org.apache.hedwig.server.LoggingExceptionHandler;
import org.apache.bookkeeper.test.PortManager;
@@ -269,7 +270,8 @@ protected void startRegion(int i) throws Exception {
getServerConfiguration(a.getPort(),
a.getSSLPort(),
regionName),
- getRegionClientConfiguration());
+ getRegionClientConfiguration(),
+ new LoggingExceptionHandler());
serversList.add(s);
s.start();
}
View
35 hedwig-server/src/test/java/org/apache/hedwig/server/LoggingExceptionHandler.java
@@ -0,0 +1,35 @@
+/**
+ * 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.hedwig.server;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Exception handler that simply logs the exception and
+ * does nothing more. To be used in tests instead of TerminateJVMExceptionHandler
+ */
+public class LoggingExceptionHandler implements Thread.UncaughtExceptionHandler {
+ static Logger logger = LoggerFactory.getLogger(LoggingExceptionHandler.class);
+
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ logger.error("Uncaught exception in thread " + t.getName(), e);
+ }
+
+}
View
4 hedwig-server/src/test/java/org/apache/hedwig/server/PubSubServerStandAloneTestBase.java
@@ -26,6 +26,8 @@
import org.apache.bookkeeper.test.PortManager;
+import org.apache.hedwig.client.conf.ClientConfiguration;
+import org.apache.hedwig.server.LoggingExceptionHandler;
import org.apache.hedwig.server.common.ServerConfiguration;
import org.apache.hedwig.server.netty.PubSubServer;
import org.apache.hedwig.util.HedwigSocketAddress;
@@ -95,7 +97,7 @@ protected HedwigSocketAddress getDefaultHedwigAddress() {
protected void startHubServer(ServerConfiguration conf) throws Exception {
defaultAddress = new HedwigSocketAddress("localhost", conf.getServerPort(),
conf.getSSLServerPort());
- server = new PubSubServer(conf);
+ server = new PubSubServer(conf, new ClientConfiguration(), new LoggingExceptionHandler());
server.start();
}
View
4 hedwig-server/src/test/java/org/apache/hedwig/server/TestPubSubServerStartup.java
@@ -25,6 +25,8 @@
import junit.framework.Assert;
+import org.apache.hedwig.client.conf.ClientConfiguration;
+import org.apache.hedwig.server.LoggingExceptionHandler;
import org.apache.bookkeeper.test.PortManager;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.hedwig.server.common.ServerConfiguration;
@@ -102,7 +104,7 @@ private void instantiateAndDestroyPubSubServer() throws IOException, Interrupted
PubSubServer hedwigServer = null;
try {
logger.info("starting hedwig broker!");
- hedwigServer = new PubSubServer(serverConf);
+ hedwigServer = new PubSubServer(serverConf, new ClientConfiguration(), new LoggingExceptionHandler());
hedwigServer.start();
} catch (Exception e) {
e.printStackTrace();
View
71 hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigHub.java
@@ -26,9 +26,6 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
import com.google.protobuf.ByteString;
import org.apache.hedwig.client.api.MessageHandler;
@@ -62,9 +59,9 @@
import org.apache.hedwig.util.ConcurrencyUtils;
import org.apache.hedwig.util.HedwigSocketAddress;
import org.apache.bookkeeper.test.PortManager;
+import org.apache.hedwig.server.LoggingExceptionHandler;
-@RunWith(Parameterized.class)
-public class TestHedwigHub extends HedwigHubTestBase {
+public abstract class TestHedwigHub extends HedwigHubTestBase {
// Client side variables
protected HedwigClient client;
@@ -80,18 +77,6 @@
REGULAR, PROXY, SSL
};
- @Parameters
- public static Collection<Object[]> configs() {
- return Arrays.asList(new Object[][] {
- { Mode.PROXY, false },
- { Mode.PROXY, true },
- { Mode.REGULAR, false },
- { Mode.REGULAR, true },
- { Mode.SSL, false },
- { Mode.SSL, true }
- });
- }
-
protected Mode mode;
protected boolean isSubscriptionChannelSharingEnabled;
@@ -240,7 +225,7 @@ protected ClientConfiguration getClientConfiguration() {
public void setUp() throws Exception {
super.setUp();
if (mode == Mode.PROXY) {
- proxy = new HedwigProxy(proxyConf);
+ proxy = new HedwigProxy(proxyConf, new LoggingExceptionHandler());
proxy.start();
}
client = new HedwigClient(getClientConfiguration());
@@ -349,7 +334,7 @@ protected void shutDownLastServer() {
// This tests out the manual sending of consume messages to the server
// instead of relying on the automatic sending by the client lib for it.
- @Test
+ @Test(timeout=10000)
public void testManualConsumeClient() throws Exception {
HedwigClient myClient = new HedwigClient(new TestClientConfiguration() {
@Override
@@ -396,7 +381,7 @@ public boolean isAutoSendConsumeMessageEnabled() {
myClient.close();
}
- @Test
+ @Test(timeout=10000)
public void testAttachToSubscriptionSuccess() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -419,20 +404,20 @@ public void testAttachToSubscriptionSuccess() throws Exception {
}
}
- @Test
+ @Test(timeout=10000)
public void testServerRedirect() throws Exception {
int batchSize = 10;
publishBatch(batchSize, true, false, 0);
}
- @Test
+ @Test(timeout=10000)
public void testSubscribeAndConsume() throws Exception {
int batchSize = 10;
subscribeToTopics(batchSize);
publishBatch(batchSize, true, true, 0);
}
- @Test
+ @Test(timeout=10000)
public void testServerFailoverPublishOnly() throws Exception {
int batchSize = 10;
publishBatch(batchSize, true, false, 0);
@@ -440,7 +425,7 @@ public void testServerFailoverPublishOnly() throws Exception {
publishBatch(batchSize, true, false, 1);
}
- @Test
+ @Test(timeout=10000)
public void testServerFailover() throws Exception {
int batchSize = 10;
subscribeToTopics(batchSize);
@@ -449,7 +434,7 @@ public void testServerFailover() throws Exception {
publishBatch(batchSize, true, true, 1);
}
- @Test
+ @Test(timeout=10000)
public void testUnsubscribe() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -481,7 +466,7 @@ public void run() {
assertFalse(consumeQueue.take());
}
- @Test
+ @Test(timeout=10000)
public void testSyncUnsubscribeWithoutSubscription() throws Exception {
boolean unsubscribeSuccess = false;
try {
@@ -494,13 +479,13 @@ public void testSyncUnsubscribeWithoutSubscription() throws Exception {
assertTrue(unsubscribeSuccess);
}
- @Test
+ @Test(timeout=10000)
public void testAsyncUnsubscribeWithoutSubscription() throws Exception {
subscriber.asyncUnsubscribe(getTopic(0), localSubscriberId, new TestCallback(queue), null);
assertFalse(queue.take());
}
- @Test
+ @Test(timeout=10000)
public void testCloseSubscription() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -532,7 +517,7 @@ public void run() {
assertFalse(consumeQueue.take());
}
- @Test
+ @Test(timeout=10000)
public void testStartDeliveryTwice() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -546,7 +531,7 @@ public void testStartDeliveryTwice() throws Exception {
}
}
- @Test
+ @Test(timeout=10000)
public void testStopDelivery() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -587,7 +572,7 @@ public void run() {
}
}
- @Test
+ @Test(timeout=10000)
public void testConsumedMessagesInOrder() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -608,7 +593,7 @@ public void testConsumedMessagesInOrder() throws Exception {
}
}
- @Test
+ @Test(timeout=10000)
public void testCreateSubscriptionFailure() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH, new TestCallback(queue),
@@ -622,7 +607,7 @@ public void testCreateSubscriptionFailure() throws Exception {
assertFalse(queue.take());
}
- @Test
+ @Test(timeout=10000)
public void testCreateSubscriptionSuccess() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.CREATE, new TestCallback(queue), null);
@@ -636,7 +621,7 @@ public void testCreateSubscriptionSuccess() throws Exception {
}
}
- @Test
+ @Test(timeout=10000)
public void testAttachToSubscriptionFailure() throws Exception {
ByteString topic = getTopic(0);
subscriber.asyncSubscribe(topic, localSubscriberId, CreateOrAttach.ATTACH, new TestCallback(queue), null);
@@ -646,7 +631,7 @@ public void testAttachToSubscriptionFailure() throws Exception {
// The following 4 tests are to make sure that the subscriberId validation
// works when it is a local subscriber and we're expecting the subscriberId
// to be in the "local" specific format.
- @Test
+ @Test(timeout=10000)
public void testSyncSubscribeWithInvalidSubscriberId() throws Exception {
boolean subscribeSuccess = false;
try {
@@ -659,14 +644,14 @@ public void testSyncSubscribeWithInvalidSubscriberId() throws Exception {
assertTrue(subscribeSuccess);
}
- @Test
+ @Test(timeout=10000)
public void testAsyncSubscribeWithInvalidSubscriberId() throws Exception {
subscriber.asyncSubscribe(getTopic(0), hubSubscriberId, CreateOrAttach.CREATE_OR_ATTACH,
new TestCallback(queue), null);
assertFalse(queue.take());
}
- @Test
+ @Test(timeout=10000)
public void testSyncUnsubscribeWithInvalidSubscriberId() throws Exception {
boolean unsubscribeSuccess = false;
try {
@@ -679,7 +664,7 @@ public void testSyncUnsubscribeWithInvalidSubscriberId() throws Exception {
assertTrue(unsubscribeSuccess);
}
- @Test
+ @Test(timeout=10000)
public void testAsyncUnsubscribeWithInvalidSubscriberId() throws Exception {
subscriber.asyncUnsubscribe(getTopic(0), hubSubscriberId, new TestCallback(queue), null);
assertFalse(queue.take());
@@ -688,7 +673,7 @@ public void testAsyncUnsubscribeWithInvalidSubscriberId() throws Exception {
// The following 4 tests are to make sure that the subscriberId validation
// also works when it is a hub subscriber and we're expecting the
// subscriberId to be in the "hub" specific format.
- @Test
+ @Test(timeout=10000)
public void testSyncHubSubscribeWithInvalidSubscriberId() throws Exception {
Client hubClient = new HedwigHubClient(new HubClientConfiguration());
Subscriber hubSubscriber = hubClient.getSubscriber();
@@ -704,7 +689,7 @@ public void testSyncHubSubscribeWithInvalidSubscriberId() throws Exception {
hubClient.close();
}
- @Test
+ @Test(timeout=10000)
public void testAsyncHubSubscribeWithInvalidSubscriberId() throws Exception {
Client hubClient = new HedwigHubClient(new HubClientConfiguration());
Subscriber hubSubscriber = hubClient.getSubscriber();
@@ -714,7 +699,7 @@ public void testAsyncHubSubscribeWithInvalidSubscriberId() throws Exception {
hubClient.close();
}
- @Test
+ @Test(timeout=10000)
public void testSyncHubUnsubscribeWithInvalidSubscriberId() throws Exception {
Client hubClient = new HedwigHubClient(new HubClientConfiguration());
Subscriber hubSubscriber = hubClient.getSubscriber();
@@ -730,7 +715,7 @@ public void testSyncHubUnsubscribeWithInvalidSubscriberId() throws Exception {
hubClient.close();
}
- @Test
+ @Test(timeout=10000)
public void testAsyncHubUnsubscribeWithInvalidSubscriberId() throws Exception {
Client hubClient = new HedwigHubClient(new HubClientConfiguration());
Subscriber hubSubscriber = hubClient.getSubscriber();
@@ -739,7 +724,7 @@ public void testAsyncHubUnsubscribeWithInvalidSubscriberId() throws Exception {
hubClient.close();
}
- @Test
+ @Test(timeout=10000)
public void testPublishWithBookKeeperError() throws Exception {
int batchSize = 10;
publishBatch(batchSize, true, false, 0);
View
36 hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigHubProxy.java
@@ -0,0 +1,36 @@
+/**
+ * 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.hedwig.server.integration;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import java.util.Collection;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class)
+public class TestHedwigHubProxy extends TestHedwigHub {
+ @Parameters
+ public static Collection<Object[]> configs() {
+ return Arrays.asList(new Object[][] { { true }, { false } });
+ }
+
+ public TestHedwigHubProxy(boolean isSubscriptionChannelSharingEnabled) {
+ super(Mode.PROXY, isSubscriptionChannelSharingEnabled);
+ }
+}
View
36 hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigHubRegular.java
@@ -0,0 +1,36 @@
+/**
+ * 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.hedwig.server.integration;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import java.util.Collection;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class)
+public class TestHedwigHubRegular extends TestHedwigHub {
+ @Parameters
+ public static Collection<Object[]> configs() {
+ return Arrays.asList(new Object[][] { { true }, { false } });
+ }
+
+ public TestHedwigHubRegular(boolean isSubscriptionChannelSharingEnabled) {
+ super(Mode.REGULAR, isSubscriptionChannelSharingEnabled);
+ }
+}
View
36 hedwig-server/src/test/java/org/apache/hedwig/server/integration/TestHedwigHubSSL.java
@@ -0,0 +1,36 @@
+/**
+ * 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.hedwig.server.integration;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import java.util.Collection;
+import java.util.Arrays;
+
+@RunWith(Parameterized.class)
+public class TestHedwigHubSSL extends TestHedwigHub {
+ @Parameters
+ public static Collection<Object[]> configs() {
+ return Arrays.asList(new Object[][] { { true }, { false } });
+ }
+
+ public TestHedwigHubSSL(boolean isSubscriptionChannelSharingEnabled) {
+ super(Mode.SSL, isSubscriptionChannelSharingEnabled);
+ }
+}
View
11 hedwig-server/src/test/java/org/apache/hedwig/server/netty/TestPubSubServer.java
@@ -42,6 +42,7 @@
import org.apache.hedwig.server.common.ServerConfiguration;
import org.apache.hedwig.server.topics.AbstractTopicManager;
import org.apache.hedwig.server.topics.TopicManager;
+import org.apache.hedwig.server.LoggingExceptionHandler;
import org.apache.hedwig.util.Callback;
import org.apache.hedwig.util.HedwigSocketAddress;
import org.apache.hedwig.zookeeper.SafeAsyncZKCallback;
@@ -51,11 +52,11 @@
@Test
public void testSecondServer() throws Exception {
PubSubServer server1 = new PubSubServer(new StandAloneServerConfiguration() {
- @Override
- public int getServerPort() {
- return super.getServerPort() + 1;
- }
- });
+ @Override
+ public int getServerPort() {
+ return super.getServerPort() + 1;
+ }
+ }, new ClientConfiguration(), new LoggingExceptionHandler());
server1.start();
server1.shutdown();
}
View
4 pom.xml
@@ -63,8 +63,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
- <argLine>-Djava.net.preferIPv4Stack=true</argLine>
+ <argLine>-Xmx1G -Djava.net.preferIPv4Stack=true</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <forkMode>always</forkMode>
+ <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
</configuration>
</plugin>
<plugin>
Please sign in to comment.
Something went wrong with that request. Please try again.