提交 052ca00a 编写于 作者: R Rajan Dhabalia 提交者: Matteo Merli

fix: intermittent test by invalidating cache to read fresh data (#642)

上级 a0044bce
......@@ -1734,6 +1734,8 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
// (1) update partitions
admin.persistentTopics().updatePartitionedTopic(partitionedTopicName, newPartitions);
// invalidate global-cache to make sure that mock-zk-cache reds fresh data
pulsar.getGlobalZkCache().invalidateAll();
// verify new partitions have been created
assertEquals(admin.persistentTopics().getPartitionedTopicMetadata(partitionedTopicName).partitions,
newPartitions);
......@@ -1755,6 +1757,8 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
// newly created partition topics
consumer2.close();
consumer2 = client.subscribe(partitionedTopicName, subName2, conf);
// sometime: mockZk fails to refresh ml-cache: so, invalidate the cache to get fresh data
pulsar.getLocalZkCacheService().managedLedgerListCache().clearTree();
assertEquals(Sets.newHashSet(admin.persistentTopics().getSubscriptions(newPartitionTopicName)),
Sets.newHashSet(subName1, subName2));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册