Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gavingaozhangmin committed Jan 19, 2022
1 parent 92552fb commit 936c21a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Expand Up @@ -1337,7 +1337,7 @@ public void testSetOffloadThreshold() throws Exception {
admin.topics().createNonPartitionedTopic(topicName.toString());

// assert we get the default which indicates it will fall back to default
assertEquals(-1, admin.namespaces().getOffloadThreshold(namespace));
assertEquals(-1, admin.namespaces().getOffloadThreshold(namespace).longValue());
// the ledger config should have the expected value
ManagedLedgerConfig ledgerConf = pulsar.getBrokerService().getManagedLedgerConfig(topicName).get();
MockLedgerOffloader offloader = new MockLedgerOffloader(OffloadPoliciesImpl.create("S3", "", "", "",
Expand All @@ -1354,7 +1354,7 @@ public void testSetOffloadThreshold() throws Exception {

// set an override for the namespace
admin.namespaces().setOffloadThreshold(namespace, 100);
assertEquals(100, admin.namespaces().getOffloadThreshold(namespace));
assertEquals(100, admin.namespaces().getOffloadThreshold(namespace).longValue());
ledgerConf = pulsar.getBrokerService().getManagedLedgerConfig(topicName).get();
admin.namespaces().getOffloadPolicies(namespace);
offloader = new MockLedgerOffloader(OffloadPoliciesImpl.create("S3", "", "", "",
Expand All @@ -1371,7 +1371,7 @@ public void testSetOffloadThreshold() throws Exception {

// set another negative value to disable
admin.namespaces().setOffloadThreshold(namespace, -2);
assertEquals(-2, admin.namespaces().getOffloadThreshold(namespace));
assertEquals(-2, admin.namespaces().getOffloadThreshold(namespace).longValue());
ledgerConf = pulsar.getBrokerService().getManagedLedgerConfig(topicName).get();
offloader = new MockLedgerOffloader(OffloadPoliciesImpl.create("S3", "", "", "",
null, null,
Expand All @@ -1387,7 +1387,7 @@ public void testSetOffloadThreshold() throws Exception {

// set back to -1 and fall back to default
admin.namespaces().setOffloadThreshold(namespace, -1);
assertEquals(-1, admin.namespaces().getOffloadThreshold(namespace));
assertEquals(-1, admin.namespaces().getOffloadThreshold(namespace).longValue());
ledgerConf = pulsar.getBrokerService().getManagedLedgerConfig(topicName).get();
offloader = new MockLedgerOffloader(OffloadPoliciesImpl.create("S3", "", "", "",
null, null,
Expand Down
Expand Up @@ -4072,7 +4072,6 @@ void setIsAllowAutoUpdateSchema(String namespace, boolean isAllowAutoUpdateSchem
CompletableFuture<Void> removeMaxTopicsPerNamespaceAsync(String namespace);

/**
<<<<<<< HEAD
* Set key value pair property for a namespace.
* If the property absents, a new property will added. Otherwise, the new value will overwrite.
*
Expand Down
Expand Up @@ -188,7 +188,7 @@ protected void testPublishOffloadAndConsumeViaThreshold(String serviceUrl, Strin
// hard to validate that it has been disabled as we'd be waiting for
// something _not_ to happen (i.e. waiting for ages), so just check
try (PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(adminUrl).build()) {
Assert.assertEquals(admin.namespaces().getOffloadThreshold(namespace), -1L);
Assert.assertEquals(admin.namespaces().getOffloadThreshold(namespace).longValue(), -1L);
}
}

Expand Down

0 comments on commit 936c21a

Please sign in to comment.