Skip to content

Commit

Permalink
Make AdminApiOffloadTest less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
eolivelli committed Jan 21, 2021
1 parent c8f571d commit 624441f
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import org.apache.bookkeeper.mledger.LedgerOffloader;
import org.apache.bookkeeper.mledger.ManagedLedgerInfo;
import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
Expand All @@ -46,6 +47,7 @@
import org.apache.pulsar.common.policies.data.ClusterData;
import org.apache.pulsar.common.policies.data.OffloadPolicies;
import org.apache.pulsar.common.policies.data.TenantInfo;
import org.awaitility.Awaitility;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
Expand Down Expand Up @@ -257,6 +259,9 @@ public void testOffload(boolean isPartitioned) throws Exception {
when(topicOffloader.getOffloadDriverName()).thenReturn("mock");
doReturn(topicOffloader).when(pulsar).createManagedLedgerOffloader(any());

Awaitility.await().atMost(3, TimeUnit.SECONDS)
.until(() -> pulsar.getTopicPoliciesService().cacheIsInitialized(TopicName.get(topicName)));

//4 set topic level offload policies
admin.topics().setOffloadPolicies(topicName, offloadPolicies);
for (int i = 0; i < 50; i++) {
Expand Down

0 comments on commit 624441f

Please sign in to comment.