shibd commented on code in PR #16943:
URL: https://github.com/apache/pulsar/pull/16943#discussion_r937885284
##########
pulsar-client-cpp/tests/ReaderTest.cc:
##########
@@ -579,3 +579,30 @@ TEST(ReaderTest, testHasMessageAvailableWhenCreated) {
EXPECT_FALSE(hasMessageAvailable);
client.close();
}
+
+TEST(ReaderTest, testReceiveAfterSeek) {
+ Client client(serviceUrl);
+ const std::string topic = "reader-test-receive-after-seek-" +
std::to_string(time(nullptr));
+
+ Producer producer;
+ ASSERT_EQ(ResultOk, client.createProducer(topic, producer));
+
+ MessageId seekMessageId;
+ for (int i = 0; i < 5; i++) {
+ MessageId messageId;
+ producer.send(MessageBuilder().setContent("msg-" +
std::to_string(i)).build(), messageId);
+ if (i == 3) {
+ seekMessageId = messageId;
+ }
+ }
+
+ Reader reader;
+ ASSERT_EQ(ResultOk, client.createReader(topic, MessageId::latest(), {},
reader));
+
+ reader.seek(seekMessageId);
+
+ bool hasMessageAvailable;
+ ASSERT_EQ(ResultOk, reader.hasMessageAvailable(hasMessageAvailable));
Review Comment:
When a connection is available, this assertion always passes, right?
Does this unit test have a mock connection unavailable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]