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

Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 5765dab883d Let ControllerTest subclasses set the cluster configs a 
controller starts with (#20158)
5765dab883d is described below

commit 5765dab883d8b6183d7221439cc28a47282469d8
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Thu Nov 5 11:26:57 2026 -0800

    Let ControllerTest subclasses set the cluster configs a controller starts 
with (#20158)
---
 .../org/apache/pinot/controller/helix/ControllerTest.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
index bdca0866ba7..a11a2f0b13f 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/ControllerTest.java
@@ -81,6 +81,7 @@ import 
org.apache.pinot.controller.helix.core.PinotHelixResourceManager;
 import org.apache.pinot.controller.helix.core.minion.PinotTaskManager;
 import org.apache.pinot.controller.helix.core.minion.TaskSchedulingContext;
 import org.apache.pinot.controller.helix.core.rebalance.TableRebalanceManager;
+import org.apache.pinot.controller.helix.core.util.HelixSetupUtils;
 import org.apache.pinot.controller.util.TableSizeReader;
 import org.apache.pinot.core.realtime.impl.fakestream.FakeStreamConfigUtils;
 import org.apache.pinot.spi.config.table.QueryConfig;
@@ -315,6 +316,16 @@ public class ControllerTest {
     return properties;
   }
 
+  /// Returns the cluster configs to write to the Helix cluster before the 
controller starts. Can be overridden to set
+  /// cluster configs for the test.
+  ///
+  /// They are written only for keys not set in the cluster yet, the same way 
the controller writes its default cluster
+  /// configs. The controller then writes its defaults only for the keys still 
missing, so these configs take
+  /// precedence, and a key changed at runtime keeps its value across a 
controller restart.
+  protected Map<String, String> getInitialClusterConfigs() {
+    return Map.of();
+  }
+
   /// Can be overridden to add more properties.
   protected void overrideControllerConf(Map<String, Object> properties) {
   }
@@ -341,6 +352,10 @@ public class ControllerTest {
     runWithHelixMock(() -> {
       assertNull(_controllerStarter, "Controller is already started");
       assertTrue(_controllerPort > 0, "Controller port is not assigned");
+      Map<String, String> clusterConfigs = getInitialClusterConfigs();
+      if (!clusterConfigs.isEmpty()) {
+        HelixSetupUtils.setupHelixClusterWithDefaultConfigs(getZkUrl(), 
getHelixClusterName(), clusterConfigs);
+      }
       _controllerStarter = createControllerStarter();
       _controllerStarter.init(new PinotConfiguration(properties));
       _controllerStarter.start();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to