You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/11/23 20:38:24 UTC
[helix] branch master updated: misc fix: (#1541)
This is an automated email from the ASF dual-hosted git repository.
jiajunwang 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 5509306 misc fix: (#1541)
5509306 is described below
commit 5509306c3b1e489c99e5931302a953ed6d3e20f0
Author: kaisun2000 <52...@users.noreply.github.com>
AuthorDate: Mon Nov 23 12:38:13 2020 -0800
misc fix: (#1541)
1/ further leakage fix of TestClusterStateVerifier, TestRoutingTableProviderPeriodicRefresh.java
2/ timeout setting general 900s as github run is slow and also TestEnableCompression 30mins to let it finish
3/ wait some time before best possible verifier start for TestJobTimeoutTaskNotStarted
4/ clean up zk resource after test finish for TestDistControllerElection
Co-authored-by: Kai Sun <ks...@ksun-mn1.linkedin.biz>
---
helix-core/src/test/conf/testng.xml | 2 +-
.../src/test/java/org/apache/helix/common/ZkTestBase.java | 7 +++++--
.../org/apache/helix/integration/TestEnableCompression.java | 2 +-
.../spectator/TestRoutingTableProviderPeriodicRefresh.java | 5 ++++-
.../helix/integration/task/TestJobTimeoutTaskNotStarted.java | 6 ++++--
.../apache/helix/participant/TestDistControllerElection.java | 2 ++
.../java/org/apache/helix/tools/TestClusterStateVerifier.java | 10 ++++++++--
7 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/helix-core/src/test/conf/testng.xml b/helix-core/src/test/conf/testng.xml
index 3fff441..0e62b39 100644
--- a/helix-core/src/test/conf/testng.xml
+++ b/helix-core/src/test/conf/testng.xml
@@ -18,7 +18,7 @@
~ under the License.
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="Suite" time-out="300000">
+<suite name="Suite" time-out="900000">
<test name="Test" preserve-order="true">
<packages>
<package name="org.apache.helix.*"/>
diff --git a/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java b/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java
index c9741a9..0b1c375 100644
--- a/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java
+++ b/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java
@@ -233,6 +233,8 @@ public class ZkTestBase {
@BeforeClass
public void beforeClass() throws Exception {
+ String testClassName = this.getShortClassName();
+ System.out.println("BeforeClass: " + testClassName + " called.");
cleanupJMXObjects();
// Giving each test some time to settle (such as gc pause, etc).
// Note that this is the best effort we could make to stabilize tests, not a complete solution
@@ -243,7 +245,7 @@ public class ZkTestBase {
@BeforeMethod
public void beforeTest(Method testMethod, ITestContext testContext) {
long startTime = System.currentTimeMillis();
- System.out.println("START " + testMethod.getName() + " at " + new Date(startTime));
+ System.out.println("START " + getShortClassName() + " " + testMethod.getName() + " at " + new Date(startTime));
testContext.setAttribute("StartTime", System.currentTimeMillis());
}
@@ -251,7 +253,7 @@ public class ZkTestBase {
public void endTest(Method testMethod, ITestContext testContext) {
Long startTime = (Long) testContext.getAttribute("StartTime");
long endTime = System.currentTimeMillis();
- System.out.println("END " + testMethod.getName() + " at " + new Date(endTime) + ", took: "
+ System.out.println("END " + getShortClassName() + " " + testMethod.getName() + " at " + new Date(endTime) + ", took: "
+ (endTime - startTime) + "ms.");
}
@@ -727,6 +729,7 @@ public class ZkTestBase {
@AfterClass
public void cleanupLiveInstanceOwners() throws InterruptedException {
String testClassName = this.getShortClassName();
+ System.out.println("AfterClass: " + testClassName + " called.");
for (String cluster : _liveInstanceOwners.keySet()) {
Map<String, HelixZkClient> clientMap = _liveInstanceOwners.get(cluster);
for (HelixZkClient client : clientMap.values()) {
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
index ce0d489..67638a6 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java
@@ -50,7 +50,7 @@ public class TestEnableCompression extends ZkTestBase {
private static final int ENABLE_COMPRESSION_WAIT = 20 * 60 * 1000;
private static final int ENABLE_COMPRESSION_POLL_INTERVAL = 2000;
- @Test()
+ @Test(timeOut = 10 * 10 * 1000L)
public void testEnableCompressionResource() throws Exception {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
diff --git a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderPeriodicRefresh.java b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderPeriodicRefresh.java
index 45ddedd..b07af57 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderPeriodicRefresh.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderPeriodicRefresh.java
@@ -54,7 +54,7 @@ public class TestRoutingTableProviderPeriodicRefresh extends ZkTestBase {
private static final String STATE_MODEL = BuiltInStateModelDefinitions.MasterSlave.name();
private static final String TEST_DB = "TestDB";
- private static final String CLASS_NAME = TestRoutingTableProvider.class.getSimpleName();
+ private static final String CLASS_NAME = TestHelper.getTestClassName();
private static final String CLUSTER_NAME = CLUSTER_PREFIX + "_" + CLASS_NAME;
private static final int PARTICIPANT_NUMBER = 3;
private static final int PARTICIPANT_START_PORT = 12918;
@@ -157,6 +157,9 @@ public class TestRoutingTableProviderPeriodicRefresh extends ZkTestBase {
_routingTableProviderLongPeriodicRefresh.shutdown();
_controller.syncStop();
+ _routingTableProvider.shutdown();
+ _routingTableProviderNoPeriodicRefresh.shutdown();
+ _routingTableProviderLongPeriodicRefresh.shutdown();
_spectator.disconnect();
_spectator_2.disconnect();
_spectator_3.disconnect();
diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
index 9956366..efa1fdb 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobTimeoutTaskNotStarted.java
@@ -24,6 +24,7 @@ import java.util.Map;
import com.google.common.collect.Sets;
import org.apache.helix.ConfigAccessor;
+import org.apache.helix.TestHelper;
import org.apache.helix.integration.manager.ClusterControllerManager;
import org.apache.helix.integration.manager.MockParticipantManager;
import org.apache.helix.mock.statemodel.MockTaskStateModelFactory;
@@ -71,8 +72,9 @@ public class TestJobTimeoutTaskNotStarted extends TaskSynchronizedTestBase {
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
_clusterVerifier =
- new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient).build();
-
+ new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient)
+ .setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
+ .build();
Assert.assertTrue(_clusterVerifier.verifyByPolling(10000, 100));
}
diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
index bf58c1b..01711d9 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java
@@ -174,7 +174,9 @@ public class TestDistControllerElection extends ZkUnitTestBase {
manager.disconnect();
controller1.shutdown();
}
+ accessor.removeProperty(keyBuilder.controllerLeader());
+ TestHelper.dropCluster(clusterName, _gZkClient);
LOG.info("END " + getShortClassName() + " at " + new Date(System.currentTimeMillis()));
}
diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java b/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
index 4c75c97..f64b8bb 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
@@ -53,6 +53,7 @@ public class TestClusterStateVerifier extends ZkUnitTestBase {
// Cluster and resource setup
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
+ _clusterName = className + "_" + methodName;
_admin = _gSetupTool.getClusterManagementTool();
_gSetupTool.addCluster(_clusterName, true);
_gSetupTool.addResourceToCluster(_clusterName, RESOURCES[0], NUM_PARTITIONS, "OnlineOffline",
@@ -133,8 +134,13 @@ public class TestClusterStateVerifier extends ZkUnitTestBase {
Assert.assertTrue(result);
// But the full cluster verification should fail
- boolean fullResult = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName).verify();
- Assert.assertFalse(fullResult);
+ verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName);
+ try {
+ boolean fullResult = verifier.verify();
+ Assert.assertFalse(fullResult);
+ } finally {
+ verifier.close();
+ }
_admin.enableCluster(_clusterName, true);
}
}