This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch 
lh-support-webservice-bindaddresses-and-advertised-listeners
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit dd90e264e72d55caf43c47b82d82e46d7ddd0920
Author: Lari Hotari <[email protected]>
AuthorDate: Wed May 20 16:56:41 2026 +0300

    [fix][test] Enable loadManagerMigrationEnabled in 
testDeployAndRollbackLoadManager
    
    The PR added a loadManagerMigrationEnabled gate to
    
RedirectManagerForLoadManagerMigration#redirectIfLoadBalancerOnBrokerIsNotExpected.
    Previously the RedirectManager always evaluated the migration redirect.
    testDeployAndRollbackLoadManager exercises the migration scenario (mixed
    ModularLoadManagerImpl and ExtensibleLoadManagerImpl brokers) and now needs
    the flag explicitly enabled on every broker so existing Extensible brokers
    will redirect lookups to the newly deployed Modular broker (and vice
    versa). Without the flag the test failed intermittently with
    "expected [pulsar://localhost:XXXX] but found [pulsar://localhost:YYYY]"
    because pulsar1/pulsar2 returned their own ownership view instead of
    redirecting to pulsar3.
    
    Restore the previous flag values on pulsar1/pulsar2 in a finally block to
    avoid leaking test state.
---
 .../extensions/ExtensibleLoadManagerImplTest.java          | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java
index 5716786e62a..30994c8df7e 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java
@@ -1135,12 +1135,21 @@ public class ExtensibleLoadManagerImplTest extends 
ExtensibleLoadManagerImplBase
 
     @Test(priority = 200)
     public void testDeployAndRollbackLoadManager() throws Exception {
+        // The migration redirect (RedirectManagerForLoadManagerMigration) is 
gated by
+        // loadManagerMigrationEnabled; enable it on the existing brokers so 
they redirect
+        // requests to the newly added broker that uses a different load 
manager.
+        boolean prevMigration1 = 
pulsar1.getConfiguration().isLoadManagerMigrationEnabled();
+        boolean prevMigration2 = 
pulsar2.getConfiguration().isLoadManagerMigrationEnabled();
+        pulsar1.getConfiguration().setLoadManagerMigrationEnabled(true);
+        pulsar2.getConfiguration().setLoadManagerMigrationEnabled(true);
+        try {
         // Test rollback to modular load manager.
         ServiceConfiguration defaultConf = getDefaultConf();
         defaultConf.setAllowAutoTopicCreation(true);
         defaultConf.setForceDeleteNamespaceAllowed(true);
         
defaultConf.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
         defaultConf.setLoadBalancerSheddingEnabled(false);
+        defaultConf.setLoadManagerMigrationEnabled(true);
         try (var additionalPulsarTestContext = 
createAdditionalPulsarTestContext(defaultConf)) {
             // start pulsar3 with old load manager
             @Cleanup
@@ -1201,6 +1210,7 @@ public class ExtensibleLoadManagerImplTest extends 
ExtensibleLoadManagerImplBase
             
conf.setLoadManagerClassName(ExtensibleLoadManagerImpl.class.getName());
             
conf.setLoadBalancerLoadSheddingStrategy(TransferShedder.class.getName());
             
conf.setLoadManagerServiceUnitStateTableViewClassName(serviceUnitStateTableViewClassName);
+            conf.setLoadManagerMigrationEnabled(true);
             try (var additionPulsarTestContext = 
createAdditionalPulsarTestContext(conf)) {
                 @Cleanup
                 var pulsar4 = additionPulsarTestContext.getPulsarService();
@@ -1329,6 +1339,10 @@ public class ExtensibleLoadManagerImplTest extends 
ExtensibleLoadManagerImplBase
                 assertEquals(consumer.receive().getValue(), "t3");
             }
         }
+        } finally {
+            
pulsar1.getConfiguration().setLoadManagerMigrationEnabled(prevMigration1);
+            
pulsar2.getConfiguration().setLoadManagerMigrationEnabled(prevMigration2);
+        }
     }
 
     @Test(priority = 200)

Reply via email to