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 bff4f8b  Cpp client: fix flaky seek test  (#1936)
bff4f8b is described below

commit bff4f8b34e4881e5673dd9d739334a424a137dd5
Author: Jia Zhai <[email protected]>
AuthorDate: Sat Jun 9 00:13:01 2018 +0800

    Cpp client: fix flaky seek test  (#1936)
    
    In BasicEndToEndTest, test case TEST(BasicEndToEndTest, testSeek) is flaky 
because of not wait enough time for consumer connection. This PR add sleep time 
to fix it.
---
 pulsar-client-cpp/tests/BasicEndToEndTest.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pulsar-client-cpp/tests/BasicEndToEndTest.cc 
b/pulsar-client-cpp/tests/BasicEndToEndTest.cc
index 47713e9..692e21f 100644
--- a/pulsar-client-cpp/tests/BasicEndToEndTest.cc
+++ b/pulsar-client-cpp/tests/BasicEndToEndTest.cc
@@ -1381,6 +1381,9 @@ TEST(BasicEndToEndTest, testSeek) {
 
     // seek to earliest, expected receive first message.
     result = consumer.seek(MessageId::earliest());
+    // Sleeping for 500ms to wait for consumer re-connect
+    usleep(500 * 1000);
+
     ASSERT_EQ(ResultOk, result);
     consumer.receive(msgReceived, 100);
     LOG_ERROR("Received message :" << msgReceived.getMessageId());
@@ -1388,7 +1391,7 @@ TEST(BasicEndToEndTest, testSeek) {
     msgNum = 0;
     expected << msgContent << msgNum;
     ASSERT_EQ(expected.str(), msgReceived.getDataAsString());
-
+    ASSERT_EQ(ResultOk, consumer.acknowledge(msgReceived));
     ASSERT_EQ(ResultOk, consumer.unsubscribe());
     ASSERT_EQ(ResultAlreadyClosed, consumer.close());
     ASSERT_EQ(ResultOk, producer.close());

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to