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

jackie 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 57d6486e9b In ClusterTest, make start port higher to avoid potential 
conflict with Kafka (#13402)
57d6486e9b is described below

commit 57d6486e9b1c984d9c33db0dca6e0dc58341ca8e
Author: Xiaotian (Jackie) Jiang <17555551+jackie-ji...@users.noreply.github.com>
AuthorDate: Sat Jun 15 19:03:29 2024 -0700

    In ClusterTest, make start port higher to avoid potential conflict with 
Kafka (#13402)
---
 .../apache/pinot/controller/helix/ControllerTest.java    | 16 ++++++++++++----
 .../helix/core/minion/PinotTaskManagerStatelessTest.java |  8 ++------
 2 files changed, 14 insertions(+), 10 deletions(-)

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 31ed486158..a42a5bcbcd 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
@@ -114,10 +114,10 @@ public class ControllerTest {
   protected final String _clusterName = getClass().getSimpleName();
   protected final List<HelixManager> _fakeInstanceHelixManagers = new 
ArrayList<>();
 
-  protected int _nextControllerPort = 16000;
-  protected int _nextBrokerPort = 17000;
-  protected int _nextServerPort = 18000;
-  protected int _nextMinionPort = 19000;
+  protected int _nextControllerPort = 20000;
+  protected int _nextBrokerPort = _nextControllerPort + 1000;
+  protected int _nextServerPort = _nextBrokerPort + 1000;
+  protected int _nextMinionPort = _nextServerPort + 1000;
 
   private ZkStarter.ZookeeperInstance _zookeeperInstance;
 
@@ -296,6 +296,14 @@ public class ControllerTest {
     FileUtils.deleteQuietly(new File(_controllerDataDir));
   }
 
+  public void restartController()
+      throws Exception {
+    assertNotNull(_controllerStarter, "Controller hasn't been started");
+    _controllerStarter.stop();
+    _controllerStarter = null;
+    startController(_controllerConfig.toMap());
+  }
+
   public int getFakeBrokerInstanceCount() {
     return _helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), 
"DefaultTenant_BROKER").size()
         + _helixAdmin.getInstancesInClusterWithTag(getHelixClusterName(), 
UNTAGGED_BROKER_INSTANCE).size();
diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java
index 175d11129c..6c63fd3a5a 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManagerStatelessTest.java
@@ -203,12 +203,8 @@ public class PinotTaskManagerStatelessTest extends 
ControllerTest {
         "JobGroupNames should have SegmentGenerationAndPushTask only");
     validateJob(MinionConstants.SegmentGenerationAndPushTask.TASK_TYPE, "0 
*/10 * ? * * *");
 
-    // Restart controller. We need to set the port after stopping the 
controller because we are reusing the same config.
-    int controllerPort = _controllerPort;
-    stopController();
-    _controllerPort = controllerPort;
-    startController(properties);
-    // wait for controller to start correctly.
+    // Restart controller.
+    restartController();
     TestUtils.waitForCondition((aVoid) -> {
       try {
         long tableSize = getTableSize(OFFLINE_TABLE_NAME);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to