HADOOP-8257. TestZKFailoverControllerStress occasionally fails with Mockito error. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-3042@1310616 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2012-04-06 22:16:33 +00:00
parent b455e54749
commit c42a90bd9e
2 changed files with 9 additions and 1 deletions

View File

@ -11,3 +11,5 @@ HADOOP-8228. Auto HA: Refactor tests and add stress tests. (todd)
HADOOP-8215. Security support for ZK Failover controller (todd) HADOOP-8215. Security support for ZK Failover controller (todd)
HADOOP-8245. Fix flakiness in TestZKFailoverController (todd) HADOOP-8245. Fix flakiness in TestZKFailoverController (todd)
HADOOP-8257. TestZKFailoverControllerStress occasionally fails with Mockito error (todd)

View File

@ -47,7 +47,6 @@ public class TestZKFailoverControllerStress extends ClientBaseWithFixes {
conf = new Configuration(); conf = new Configuration();
conf.set(ZKFailoverController.ZK_QUORUM_KEY, hostPort); conf.set(ZKFailoverController.ZK_QUORUM_KEY, hostPort);
this.cluster = new MiniZKFCCluster(conf, getServer(serverFactory)); this.cluster = new MiniZKFCCluster(conf, getServer(serverFactory));
cluster.start();
} }
@After @After
@ -61,6 +60,7 @@ public class TestZKFailoverControllerStress extends ClientBaseWithFixes {
*/ */
@Test(timeout=(STRESS_RUNTIME_SECS + EXTRA_TIMEOUT_SECS) * 1000) @Test(timeout=(STRESS_RUNTIME_SECS + EXTRA_TIMEOUT_SECS) * 1000)
public void testExpireBackAndForth() throws Exception { public void testExpireBackAndForth() throws Exception {
cluster.start();
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
long runFor = STRESS_RUNTIME_SECS * 1000; long runFor = STRESS_RUNTIME_SECS * 1000;
@ -86,6 +86,7 @@ public class TestZKFailoverControllerStress extends ClientBaseWithFixes {
*/ */
@Test(timeout=(STRESS_RUNTIME_SECS + EXTRA_TIMEOUT_SECS) * 1000) @Test(timeout=(STRESS_RUNTIME_SECS + EXTRA_TIMEOUT_SECS) * 1000)
public void testRandomExpirations() throws Exception { public void testRandomExpirations() throws Exception {
cluster.start();
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
long runFor = STRESS_RUNTIME_SECS * 1000; long runFor = STRESS_RUNTIME_SECS * 1000;
@ -119,6 +120,11 @@ public class TestZKFailoverControllerStress extends ClientBaseWithFixes {
.when(cluster.getService(1).proxy).monitorHealth(); .when(cluster.getService(1).proxy).monitorHealth();
ActiveStandbyElector.NUM_RETRIES = 100; ActiveStandbyElector.NUM_RETRIES = 100;
// Don't start until after the above mocking. Otherwise we can get
// Mockito errors if the HM calls the proxy in the middle of
// setting up the mock.
cluster.start();
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
while (System.currentTimeMillis() - st < runFor) { while (System.currentTimeMillis() - st < runFor) {
cluster.getTestContext().checkException(); cluster.getTestContext().checkException();