zymap commented on code in PR #21008:
URL: https://github.com/apache/pulsar/pull/21008#discussion_r1297997777
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java:
##########
@@ -133,43 +138,56 @@ public void testHasMessageAvailableWithoutBatch() throws
Exception {
}
}
Assert.assertTrue(keys.isEmpty());
+ reader.closeAsync().get(3, TimeUnit.SECONDS);
}
@Test
public void testHasMessageAvailableWithBatch() throws Exception {
int numKeys = 20;
- String topic = "persistent://my-property/my-ns/my-raw-topic";
+ String topic = "persistent://my-property/my-ns/" +
BrokerTestUtil.newUniqueName("reader");
Set<String> keys = publishMessages(topic, numKeys, true);
RawReader reader = RawReader.create(pulsarClient, topic,
subscription).get();
int messageCount = 0;
+ AtomicBoolean error = new AtomicBoolean(false);
+ List<MessageId> ids = new ArrayList<>();
+ List<String> keys2 = new ArrayList<>();
while (true) {
boolean hasMsg = reader.hasMessageAvailableAsync().get();
if (hasMsg && (messageCount == numKeys)) {
- Assert.fail("HasMessageAvailable shows still has message when
there is no message");
+ error.set(true);
Review Comment:
Why do you change this? If you are using the Atomicboolean, you need to
break after the set. Otherwise, this test will be blocked at
`reader.readNextAsync().get()` because it shows there have messages but no
message can be read.
--
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]