Skip to content

Commit 90c24a1

Browse files
committed
add comment for test
1 parent 8c6eb0c commit 90c24a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/broker/service/AbstractTopicTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void testOverwriteOldProducerAfterTopicClosed(
127127

128128
// Add old producer
129129
topic.addProducer(oldProducer, new CompletableFuture<>()).join();
130-
130+
131131
CountDownLatch oldCnxCheckInvokedLatch = new CountDownLatch(1);
132132
CountDownLatch oldCnxCheckStartLatch = new CountDownLatch(1);
133133
doAnswer(invocation -> {
@@ -149,11 +149,17 @@ public void testOverwriteOldProducerAfterTopicClosed(
149149
CompletableFuture<Optional<Long>> producerEpoch =
150150
topic.addProducer(newProducer, new CompletableFuture<>());
151151

152+
// Wait until new producer entered `AbstractTopic#tryOverwriteOldProducer`
152153
oldCnxCheckInvokedLatch.await();
154+
153155
topic.close(true);
154156
// Run pending tasks to remove old producer from topic.
155157
((EmbeddedChannel) oldCnx.ctx().channel()).runPendingTasks();
158+
159+
// Unblock ServerCnx#checkConnectionLiveness to resume `AbstractTopic#tryOverwriteOldProducer`
156160
oldCnxCheckStartLatch.countDown();
161+
162+
// As topic is fenced, adding new producer should fail.
157163
try {
158164
producerEpoch.join();
159165
fail("TopicFencedException expected");

0 commit comments

Comments
 (0)