Skip to content

Commit

Permalink
4/17
Browse files Browse the repository at this point in the history
  • Loading branch information
heesung-sn committed Apr 17, 2024
1 parent 62a91d8 commit 1f28966
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.admin.AdminApiTest.MockedPulsarService;
import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
import org.apache.pulsar.broker.loadbalance.extensions.ExtensibleLoadManagerImpl;
import org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl;
import org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerWrapper;
import org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl;
Expand Down Expand Up @@ -155,8 +156,8 @@ public void setup() throws Exception {
// namespace ownership
mockPulsarSetup = new MockedPulsarService(this.conf);
mockPulsarSetup.setup();

setupClusters();
setupSystemNamespace();
}

@Test
Expand Down Expand Up @@ -234,6 +235,9 @@ private void cleanupCluster() throws Exception {
pulsar.getConfiguration().setForceDeleteTenantAllowed(true);
pulsar.getConfiguration().setForceDeleteNamespaceAllowed(true);
for (String tenant : admin.tenants().getTenants()) {
if (tenant.equals("pulsar")) {
continue;
}
for (String namespace : admin.namespaces().getNamespaces(tenant)) {
deleteNamespaceWithRetry(namespace, true, admin, pulsar,
mockPulsarSetup.getPulsar());
Expand Down Expand Up @@ -492,6 +496,9 @@ private void setTopicPoliciesAndValidate(PulsarAdmin admin2
*/
@Test
public void nonPersistentTopics() throws Exception {
if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
return;
}
final String topicName = "nonPersistentTopic";

final String nonPersistentTopicName = "non-persistent://" + defaultNamespace + "/" + topicName;
Expand Down Expand Up @@ -1352,6 +1359,10 @@ public void brokerNamespaceIsolationPolicies() throws Exception {
// 2. update isolation policy, without broker matched, lookup will fail.
@Test
public void brokerNamespaceIsolationPoliciesUpdateOnTime() throws Exception {
if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
return;
}

String brokerName = pulsar.getAdvertisedAddress();
String ns1Name = defaultTenant + "/test_ns1_iso_" + System.currentTimeMillis();
admin.namespaces().createNamespace(ns1Name, Set.of("test"));
Expand Down Expand Up @@ -1702,6 +1713,9 @@ private void setNamespaceAttr(NamespaceAttr namespaceAttr){

@Test(dataProvider = "namespaceAttrs")
public void testDeleteNamespace(NamespaceAttr namespaceAttr) throws Exception {
if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
return;
}
restartClusterAfterTest();

// Set conf.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl;
import org.apache.bookkeeper.mledger.impl.ManagedLedgerMBeanImpl;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.loadbalance.extensions.ExtensibleLoadManagerImpl;
import org.apache.pulsar.broker.service.BrokerTestBase;
import org.apache.pulsar.broker.stats.metrics.ManagedLedgerMetrics;
import org.apache.pulsar.client.api.Producer;
Expand Down Expand Up @@ -71,7 +72,9 @@ public void testManagedLedgerMetrics() throws Exception {

final String addEntryRateKey = "brk_ml_AddEntryMessagesRate";
List<Metrics> list1 = metrics.generate();
Assert.assertTrue(list1.isEmpty());
if (!ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
Assert.assertTrue(list1.isEmpty());
}

Producer<byte[]> producer = pulsarClient.newProducer().topic("persistent://my-property/use/my-ns/my-topic1")
.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.regex.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl;
import org.apache.pulsar.broker.loadbalance.extensions.ExtensibleLoadManagerImpl;
import org.apache.pulsar.broker.service.BrokerTestBase;
import org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsGenerator;
import org.apache.pulsar.client.api.Consumer;
Expand Down Expand Up @@ -69,7 +69,6 @@ public class TransactionMetricsTest extends BrokerTestBase {
protected void setup() throws Exception {
ServiceConfiguration serviceConfiguration = getDefaultConf();
serviceConfiguration.setTransactionCoordinatorEnabled(true);
serviceConfiguration.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
super.baseSetup(serviceConfiguration);
}

Expand Down Expand Up @@ -287,6 +286,9 @@ public void testManagedLedgerMetrics() throws Exception {
PrometheusMetricsGenerator.generate(pulsar, false, false, false, statsOut);
metricsStr = statsOut.toString();
metrics = parseMetrics(metricsStr);
if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
return;
}
metric = metrics.get("pulsar_storage_size");
assertEquals(metric.size(), 2);
metric = metrics.get("pulsar_storage_logical_size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import org.apache.bookkeeper.client.PulsarMockLedgerHandle;
import org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl;
import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
import org.apache.pulsar.broker.loadbalance.extensions.ExtensibleLoadManagerImpl;
import org.apache.pulsar.broker.namespace.OwnershipCache;
import org.apache.pulsar.broker.resources.BaseResources;
import org.apache.pulsar.broker.service.AbstractDispatcherSingleActiveConsumer;
Expand Down Expand Up @@ -157,6 +158,9 @@ public Object[][] booleanFlagProvider() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testDisconnectClientWithoutClosingConnection() throws Exception {
if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(pulsar)) {
return;
}

final String ns1 = "my-property/con-ns1";
final String ns2 = "my-property/con-ns2";
Expand Down

0 comments on commit 1f28966

Please sign in to comment.