This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new c092995aa Add some test clean up logic for after tests
c092995aa is described below
commit c092995aaf8efe9db7d311790d8adc701cbe277b
Author: Junkai Xue <[email protected]>
AuthorDate: Sat Feb 28 00:34:12 2026 -0800
Add some test clean up logic for after tests
1. TestInstanceOperation.java (line 175)
- Added missing deleteCluster(CLUSTER_NAME) in @AfterClass
2. TestTopologyMigration.java (line 130)
- Added missing deleteCluster(CLUSTER_NAME) in @AfterClass
3. TestCustomizedViewAggregation.java (lines 71, 95, 172)
- Added _clusterName field to store cluster name
- Updated @BeforeClass to use _clusterName
- Added deleteCluster(_clusterName) in @AfterClass
---
.../integration/TestCustomizedViewAggregation.java | 18 +++++++++++-------
.../integration/controller/TestTopologyMigration.java | 3 +++
.../integration/rebalancer/TestInstanceOperation.java | 5 +++++
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git
a/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java
b/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java
index f3d5df03a..6dcb64faf 100644
---
a/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java
+++
b/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java
@@ -68,6 +68,7 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
private static Set<String> _aggregationEnabledTypes;
// The set contains customized state types that routing table provider shows
to users
private static Set<String> _routingTableProviderDataSources;
+ private String _clusterName;
private String INSTANCE_0;
private String INSTANCE_1;
private final String RESOURCE_0 = "TestDB0";
@@ -91,12 +92,12 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
public void beforeClass() throws Exception {
super.beforeClass();
- String clusterName = TestHelper.getTestClassName();
+ _clusterName = TestHelper.getTestClassName();
int n = 2;
- System.out.println("START " + clusterName + " at " + new
Date(System.currentTimeMillis()));
+ System.out.println("START " + _clusterName + " at " + new
Date(System.currentTimeMillis()));
- TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port
+ TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, // participant port
"localhost", // participant name prefix
"TestDB", // resource name prefix
2, // resources
@@ -106,7 +107,7 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
"MasterSlave", true); // do rebalance
_controller =
- new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
+ new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0");
_controller.syncStart();
// start participants
@@ -114,7 +115,7 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
for (int i = 0; i < n; i++) {
String instanceName = "localhost_" + (12918 + i);
- _participants[i] = new MockParticipantManager(ZK_ADDR, clusterName,
instanceName);
+ _participants[i] = new MockParticipantManager(ZK_ADDR, _clusterName,
instanceName);
_participants[i].syncStart();
}
@@ -122,11 +123,11 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
INSTANCE_1 = _participants[1].getInstanceName();
_manager = HelixManagerFactory
- .getZKHelixManager(clusterName, "admin", InstanceType.ADMINISTRATOR,
ZK_ADDR);
+ .getZKHelixManager(_clusterName, "admin", InstanceType.ADMINISTRATOR,
ZK_ADDR);
_manager.connect();
_spectator = HelixManagerFactory
- .getZKHelixManager(clusterName, "spectator", InstanceType.SPECTATOR,
ZK_ADDR);
+ .getZKHelixManager(_clusterName, "spectator", InstanceType.SPECTATOR,
ZK_ADDR);
_spectator.connect();
// Initialize customized state provider
@@ -166,6 +167,9 @@ public class TestCustomizedViewAggregation extends
ZkUnitTestBase {
_routingTableProvider.shutdown();
_manager.disconnect();
_spectator.disconnect();
+
+ // Delete the cluster from Zookeeper
+ deleteCluster(_clusterName);
}
/**
diff --git
a/helix-core/src/test/java/org/apache/helix/integration/controller/TestTopologyMigration.java
b/helix-core/src/test/java/org/apache/helix/integration/controller/TestTopologyMigration.java
index 827c4ce15..a7bdf6a26 100644
---
a/helix-core/src/test/java/org/apache/helix/integration/controller/TestTopologyMigration.java
+++
b/helix-core/src/test/java/org/apache/helix/integration/controller/TestTopologyMigration.java
@@ -127,6 +127,9 @@ public class TestTopologyMigration extends ZkTestBase {
participant.syncStop();
}
_controller.syncStop();
+
+ // Delete the cluster from Zookeeper
+ deleteCluster(CLUSTER_NAME);
}
/**
diff --git
a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
index 97840a645..5f49112a6 100644
---
a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
+++
b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
@@ -164,6 +164,7 @@ public class TestInstanceOperation extends ZkTestBase {
Assert.assertTrue(_clusterVerifier.verifyByPolling());
+ // Cleanup order: 1) disconnect participants 2) disconnect controller 3)
delete cluster
for (MockParticipantManager p : _participants) {
p.syncStop();
}
@@ -172,6 +173,10 @@ public class TestInstanceOperation extends ZkTestBase {
_routingTableProviderEV.shutdown();
_routingTableProviderCS.shutdown();
_spectator.disconnect();
+
+ // Delete the cluster from Zookeeper
+ deleteCluster(CLUSTER_NAME);
+ System.out.println("END " + CLASS_NAME + " at " + new
Date(System.currentTimeMillis()));
}
@BeforeMethod