This is an automated email from the ASF dual-hosted git repository.
xiangfu0 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 eca9ea7afde Reuse the shared hybrid cluster for tenant rebalance tests
(#20084)
eca9ea7afde is described below
commit eca9ea7afde8c746bda0f2427ac1a4cc4101ef00
Author: Xiang Fu <[email protected]>
AuthorDate: Fri Oct 30 16:24:37 2026 -0700
Reuse the shared hybrid cluster for tenant rebalance tests (#20084)
* Reuse the shared hybrid cluster for tenant rebalance tests
* Preserve tenant hybrid table cleanup order
---------
Co-authored-by: Chen Liang <[email protected]>
---
pinot-integration-tests/pom.xml | 1 -
.../SharedHybridClusterIntegrationTestSuite.java | 18 ++++--
.../tests/TenantRebalanceIntegrationTest.java | 72 +++++++++++++++++++++-
.../tests/suites/SharedHybridSuite.java | 4 +-
4 files changed, 87 insertions(+), 8 deletions(-)
diff --git a/pinot-integration-tests/pom.xml b/pinot-integration-tests/pom.xml
index d0b258332e1..9ae1c0b5b9f 100644
--- a/pinot-integration-tests/pom.xml
+++ b/pinot-integration-tests/pom.xml
@@ -222,7 +222,6 @@
<include>org/apache/pinot/integration/tests/M*Test.java</include>
<include>org/apache/pinot/integration/tests/N*Test.java</include>
<include>org/apache/pinot/integration/tests/GrpcBrokerClusterIntegrationTest.java</include>
-
<include>org/apache/pinot/integration/tests/TenantRebalanceIntegrationTest.java</include>
<include>org/apache/pinot/integration/tests/legacy/*Test.java</include>
</includes>
<excludes>
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SharedHybridClusterIntegrationTestSuite.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SharedHybridClusterIntegrationTestSuite.java
index 2a88ab895b3..510c4822ecb 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SharedHybridClusterIntegrationTestSuite.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SharedHybridClusterIntegrationTestSuite.java
@@ -295,12 +295,18 @@ public abstract class
SharedHybridClusterIntegrationTestSuite extends BaseCluste
final HybridScenarioLease newScenario(String tableName, String topicName)
throws Throwable {
+ return newScenario(tableName, topicName, TableType.REALTIME);
+ }
+
+ final HybridScenarioLease newScenario(String tableName, String topicName,
TableType firstTableToDrop)
+ throws Throwable {
enforceScenarioCleanupBarrier();
File scenarioDir = new File(_tempDir, tableName);
File segmentDir = new File(scenarioDir, "segmentDir");
File tarDir = new File(scenarioDir, "tarDir");
TestUtils.ensureDirectoriesExistAndEmpty(scenarioDir, segmentDir, tarDir);
- HybridScenarioLease lease = new HybridScenarioLease(tableName, topicName,
scenarioDir, segmentDir, tarDir);
+ HybridScenarioLease lease =
+ new HybridScenarioLease(tableName, topicName, scenarioDir, segmentDir,
tarDir, firstTableToDrop);
_scenarioLeases.add(lease);
return lease;
}
@@ -756,8 +762,9 @@ public abstract class
SharedHybridClusterIntegrationTestSuite extends BaseCluste
}
private Throwable cleanUpScenario(HybridScenarioLease lease, Throwable
cleanupFailure) {
- cleanupFailure = cleanUpTable(lease, TableType.REALTIME, cleanupFailure);
- cleanupFailure = cleanUpTable(lease, TableType.OFFLINE, cleanupFailure);
+ cleanupFailure = cleanUpTable(lease, lease._firstTableToDrop,
cleanupFailure);
+ TableType secondTableToDrop = lease._firstTableToDrop == TableType.OFFLINE
? TableType.REALTIME : TableType.OFFLINE;
+ cleanupFailure = cleanUpTable(lease, secondTableToDrop, cleanupFailure);
boolean tablesRemoved = !lease._offlineTableCreated &&
!lease._realtimeTableCreated;
if (tablesRemoved && lease._routingTableMayExist) {
@@ -1014,6 +1021,7 @@ public abstract class
SharedHybridClusterIntegrationTestSuite extends BaseCluste
final File _scenarioDir;
final File _segmentDir;
final File _tarDir;
+ final TableType _firstTableToDrop;
boolean _schemaCreated;
boolean _offlineTableCreated;
boolean _realtimeTableCreated;
@@ -1024,12 +1032,14 @@ public abstract class
SharedHybridClusterIntegrationTestSuite extends BaseCluste
long _offlineInputCount;
long _realtimeInputCount;
- private HybridScenarioLease(String tableName, String topicName, File
scenarioDir, File segmentDir, File tarDir) {
+ private HybridScenarioLease(String tableName, String topicName, File
scenarioDir, File segmentDir, File tarDir,
+ TableType firstTableToDrop) {
_tableName = tableName;
_topicName = topicName;
_scenarioDir = scenarioDir;
_segmentDir = segmentDir;
_tarDir = tarDir;
+ _firstTableToDrop = firstTableToDrop;
}
}
}
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TenantRebalanceIntegrationTest.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TenantRebalanceIntegrationTest.java
index 9595242cb35..f2c33f4260d 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TenantRebalanceIntegrationTest.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/TenantRebalanceIntegrationTest.java
@@ -22,7 +22,12 @@ import java.util.Map;
import javax.annotation.Nullable;
import org.apache.pinot.common.restlet.resources.TenantRebalanceResult;
import
org.apache.pinot.controller.helix.core.rebalance.tenant.TenantRebalanceConfig;
+import
org.apache.pinot.integration.tests.SharedHybridClusterIntegrationTestSuite.HybridScenarioLease;
+import
org.apache.pinot.integration.tests.SharedHybridClusterIntegrationTestSuite.SharedHybridSuiteLease;
+import org.apache.pinot.spi.config.table.TableType;
import org.apache.pinot.spi.utils.JsonUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.testng.Assert.assertFalse;
@@ -30,11 +35,74 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-public class TenantRebalanceIntegrationTest extends
BaseHybridClusterIntegrationTest {
+/// Verifies tenant rebalance request handling using isolated tables in the
shared hybrid cluster.
+/// Scenarios run sequentially; a directly selected class owns a temporary
cluster through the same lease.
+public class TenantRebalanceIntegrationTest {
+ private static final String TABLE_NAME = "mytableTenantRebalance";
+ private static final String TOPIC_NAME = "TenantRebalanceIntegrationTest";
+
+ private SharedHybridSuiteLease _suiteLease;
+ private SharedHybridClusterIntegrationTestSuite _owner;
+ private HybridScenarioLease _scenario;
+
+ @BeforeClass(alwaysRun = true)
+ public void setUp()
+ throws Throwable {
+ try {
+ _suiteLease =
SharedHybridClusterIntegrationTestSuite.acquireSharedSuite();
+ _owner = _suiteLease.getOwner();
+ // Preserve the original fixture's offline-first teardown to exercise
both hybrid table removal orders.
+ _scenario = _owner.newScenario(TABLE_NAME, TOPIC_NAME,
TableType.OFFLINE);
+ _owner.setUpStandardScenario(_scenario, null,
SharedHybridClusterIntegrationTestSuite.DEFAULT_HYBRID_COUNT);
+ } catch (Throwable t) {
+ try {
+ tearDown();
+ } catch (Throwable cleanupFailure) {
+ t.addSuppressed(cleanupFailure);
+ }
+ throw t;
+ }
+ }
+
+ @AfterClass(alwaysRun = true)
+ public void tearDown()
+ throws Throwable {
+ Throwable cleanupFailure = null;
+ if (_scenario != null) {
+ try {
+ _owner.closeScenario(_scenario, null);
+ } catch (Throwable t) {
+ cleanupFailure = t;
+ } finally {
+ _scenario = null;
+ }
+ }
+ if (_suiteLease != null) {
+ try {
+ _suiteLease.close(null);
+ } catch (Throwable t) {
+ cleanupFailure =
SharedHybridClusterIntegrationTestSuite.appendCleanupFailure(cleanupFailure, t);
+ } finally {
+ _suiteLease = null;
+ _owner = null;
+ }
+ }
+ if (cleanupFailure != null) {
+ throw cleanupFailure;
+ }
+ }
+
+ private String getTableName() {
+ return TABLE_NAME;
+ }
+
+ private String getServerTenant() {
+ return SharedHybridClusterIntegrationTestSuite.TENANT_NAME;
+ }
private TenantRebalanceResult rebalanceTenant(TenantRebalanceConfig config,
@Nullable Map<String, String> queryParams)
throws Exception {
- return getOrCreateAdminClient().getTenantClient()
+ return _owner.getOrCreateAdminClient().getTenantClient()
.rebalanceTenantWithConfigObject(config.getTenantName(),
JsonUtils.objectToString(config), queryParams);
}
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/suites/SharedHybridSuite.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/suites/SharedHybridSuite.java
index 60e5ae9f011..1e4c5882bac 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/suites/SharedHybridSuite.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/suites/SharedHybridSuite.java
@@ -22,6 +22,7 @@ import org.apache.pinot.common.utils.OrderedTestNGSuite;
import
org.apache.pinot.integration.tests.DateTimeFieldSpecHybridClusterIntegrationTest;
import org.apache.pinot.integration.tests.HybridClusterIntegrationTest;
import org.apache.pinot.integration.tests.IngestionConfigHybridIntegrationTest;
+import org.apache.pinot.integration.tests.TenantRebalanceIntegrationTest;
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasses;
@@ -37,7 +38,8 @@ import org.junit.platform.suite.api.Suite;
@SelectClasses({
HybridClusterIntegrationTest.class,
DateTimeFieldSpecHybridClusterIntegrationTest.class,
- IngestionConfigHybridIntegrationTest.class
+ IngestionConfigHybridIntegrationTest.class,
+ TenantRebalanceIntegrationTest.class
})
public class SharedHybridSuite extends OrderedTestNGSuite {
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]