You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/09/18 07:43:56 UTC
[incubator-pulsar] branch master updated: [tests] make
PersistentQueueE2ETest tolerant failures during deleting topic at cleanup
(#2600)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new aebfbba [tests] make PersistentQueueE2ETest tolerant failures during deleting topic at cleanup (#2600)
aebfbba is described below
commit aebfbba2a9f2882944bd1854672f4538a9d27177
Author: Sijie Guo <gu...@gmail.com>
AuthorDate: Tue Sep 18 00:43:50 2018 -0700
[tests] make PersistentQueueE2ETest tolerant failures during deleting topic at cleanup (#2600)
*Motivation*
"Topic has active producers/subscriptions" can be thrown during deleting topic at cleanup.
This kind of error can be ignored during cleaning up to make the tests more robust.
*Changes*
Make PersistentQueueE2ETest toelrant failures during cleaning up topics.
---
.../broker/service/PersistentQueueE2ETest.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PersistentQueueE2ETest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PersistentQueueE2ETest.java
index c41a07a..2937ca0 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PersistentQueueE2ETest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PersistentQueueE2ETest.java
@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.collections.CollectionUtils;
import org.apache.pulsar.broker.service.persistent.PersistentSubscription;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
+import org.apache.pulsar.client.admin.PulsarAdminException;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.ConsumerBuilder;
import org.apache.pulsar.client.api.Message;
@@ -76,6 +77,14 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
private static final Logger log = LoggerFactory.getLogger(PersistentQueueE2ETest.class);
+ private void deleteTopic(String topicName) {
+ try {
+ admin.topics().delete(topicName);
+ } catch (PulsarAdminException pae) {
+ // it is okay to get exception if it is cleaning up.
+ }
+ }
+
@Test
public void testSimpleConsumerEvents() throws Exception {
final String topicName = "persistent://prop/use/ns-abc/shared-topic1";
@@ -172,7 +181,7 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
producer.close();
consumer2.close();
- admin.topics().delete(topicName);
+ deleteTopic(topicName);
}
@Test
@@ -220,7 +229,8 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
assertTrue(CollectionUtils.subtract(messagesProduced, messagesConsumed).isEmpty());
consumer1.close();
- admin.topics().delete(topicName);
+
+ deleteTopic(topicName);
}
@Test
@@ -279,7 +289,8 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
consumer1.close();
consumer2.close();
- admin.topics().delete(topicName);
+
+ deleteTopic(topicName);
}
// this test is good to have to see the distribution, but every now and then it gets slightly different than the
@@ -352,7 +363,8 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
consumer1.close();
consumer2.close();
consumer3.close();
- admin.topics().delete(topicName);
+
+ deleteTopic(topicName);
}
@Test(timeOut = 300000)
@@ -550,6 +562,7 @@ public class PersistentQueueE2ETest extends BrokerTestBase {
producer.close();
consumer1.close();
consumer2.close();
- admin.topics().delete(topicName);
+
+ deleteTopic(topicName);
}
}