From c6a17a1c5d5b2af7c31ae619c2221e925592138f Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Thu, 1 Jul 2021 13:08:48 +0800 Subject: [PATCH 1/4] Fixed wrong wait time unit. --- .../java/org/apache/pulsar/client/cli/PulsarClientToolTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java index e9dc0e53627ba..c1c82dc5210b1 100644 --- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java +++ b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java @@ -186,7 +186,7 @@ public void testDurableSubscribe() throws Exception { Assert.assertFalse(future.isCompletedExceptionally()); future.get(); //wait for close - Awaitility.waitAtMost(Duration.ofDays(2000)); + Awaitility.waitAtMost(Duration.ofMillis(2000)); List subscriptions = admin.topics().getSubscriptions(topicName); Assert.assertNotNull(subscriptions); Assert.assertEquals(subscriptions.size(), 1); From 55f46ebe9c6ea49c1895b34b46d7ee4d316af625 Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Thu, 1 Jul 2021 13:45:46 +0800 Subject: [PATCH 2/4] Fixed copy-paste error in the test --- .../pulsar/client/cli/PulsarClientToolTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java index c1c82dc5210b1..789e2d58b6465 100644 --- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java +++ b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java @@ -183,13 +183,13 @@ public void testDurableSubscribe() throws Exception { String[] args = {"produce", "--messages", "Have a nice day", "-n", Integer.toString(numberOfMessages), "-r", "20", "-p", "key1=value1", "-p", "key2=value2", "-k", "partition_key", topicName}; Assert.assertEquals(pulsarClientToolProducer.run(args), 0); - Assert.assertFalse(future.isCompletedExceptionally()); - future.get(); - //wait for close - Awaitility.waitAtMost(Duration.ofMillis(2000)); - List subscriptions = admin.topics().getSubscriptions(topicName); - Assert.assertNotNull(subscriptions); - Assert.assertEquals(subscriptions.size(), 1); + + try { + future.get(10, TimeUnit.SECONDS); + Assert.assertFalse(future.isCompletedExceptionally()); + } catch (Exception e) { + Assert.fail("consumer was unable to decrypt messages", e); + } } @Test(timeOut = 20000) From cfaa8c679d34fe391dc838cb5dccce402d233be2 Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Thu, 1 Jul 2021 13:52:15 +0800 Subject: [PATCH 3/4] Delete useless test. --- .../java/org/apache/pulsar/client/cli/PulsarClientToolTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java index 789e2d58b6465..ebfb94793212d 100644 --- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java +++ b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java @@ -186,7 +186,6 @@ public void testDurableSubscribe() throws Exception { try { future.get(10, TimeUnit.SECONDS); - Assert.assertFalse(future.isCompletedExceptionally()); } catch (Exception e) { Assert.fail("consumer was unable to decrypt messages", e); } @@ -230,7 +229,6 @@ public void testEncryption() throws Exception { try { future.get(10, TimeUnit.SECONDS); - Assert.assertFalse(future.isCompletedExceptionally()); } catch (Exception e) { Assert.fail("consumer was unable to decrypt messages", e); } From 20d1e0017d10d54afbad66223d6b3ea66ca1e777 Mon Sep 17 00:00:00 2001 From: Qiang Zhao Date: Thu, 1 Jul 2021 14:01:08 +0800 Subject: [PATCH 4/4] Fixed typo --- .../java/org/apache/pulsar/client/cli/PulsarClientToolTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java index ebfb94793212d..d56308911ddf4 100644 --- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java +++ b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/client/cli/PulsarClientToolTest.java @@ -187,7 +187,7 @@ public void testDurableSubscribe() throws Exception { try { future.get(10, TimeUnit.SECONDS); } catch (Exception e) { - Assert.fail("consumer was unable to decrypt messages", e); + Assert.fail("consumer was unable to receive messages", e); } }