BewareMyPower commented on code in PR #409:
URL: https://github.com/apache/pulsar-client-cpp/pull/409#discussion_r1519304449
##########
tests/ReaderTest.cc:
##########
@@ -784,4 +784,56 @@ TEST(ReaderSeekTest, testStartAtLatestMessageId) {
producer.close();
}
+TEST(ReaderTest, testSeekInProgress) {
+ Client client(serviceUrl);
+ const auto topic = "test-seek-in-progress-" +
std::to_string(time(nullptr));
+ Reader reader;
+ ASSERT_EQ(ResultOk, client.createReader(topic, MessageId::earliest(), {},
reader));
+
+ reader.seekAsync(MessageId::earliest(), [](Result) {});
+ Promise<Result, Result> promise;
+ reader.seekAsync(MessageId::earliest(), [promise](Result result) {
promise.setValue(result); });
+ Result result;
+ promise.getFuture().get(result);
+ ASSERT_EQ(result, ResultNotAllowedError);
+ client.close();
+}
+
+TEST_P(ReaderTest, testHasMessageAvailableAfterSeekToEnd) {
+ Client client(serviceUrl);
+ const auto topic = "test-has-message-available-after-seek-to-end-" +
std::to_string(time(nullptr));
+ Producer producer;
+ ASSERT_EQ(ResultOk, client.createProducer(topic, producer));
+ Reader reader;
+ ASSERT_EQ(ResultOk, client.createReader(topic, MessageId::earliest(), {},
reader));
+
+ producer.send(MessageBuilder().setContent("msg-0").build());
+ producer.send(MessageBuilder().setContent("msg-1").build());
+
+ bool hasMessageAvailable;
+ if (GetParam()) {
Review Comment:
I moved it to another test
--
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]