helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject git commit: [HELIX-7] update waiting parameters in testcases to fix helix random test failures
Date Thu, 15 Nov 2012 00:50:46 GMT
Updated Branches:
  refs/heads/master 22113e826 -> 2d2b85f94


[HELIX-7] update waiting parameters in testcases to fix helix random
test failures

Project: http://git-wip-us.apache.org/repos/asf/incubator-helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-helix/commit/2d2b85f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/2d2b85f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/2d2b85f9

Branch: refs/heads/master
Commit: 2d2b85f94e113e54733bfd8a792c1e1318f70a24
Parents: 22113e8
Author: slu2011 <lushi04@gmail.com>
Authored: Wed Nov 14 16:50:10 2012 -0800
Committer: slu2011 <lushi04@gmail.com>
Committed: Wed Nov 14 16:50:10 2012 -0800

----------------------------------------------------------------------
 .../helix/tools/TestHelixAdminScenariosRest.java   |    9 +++++
 .../TestEnablePartitionDuringDisable.java          |    4 +-
 .../helix/integration/TestMessagingService.java    |   18 +++++-----
 .../helix/integration/TestSchedulerMessage.java    |   27 ++++++++++----
 .../helix/tools/TestHelixAdminScenariosCli.java    |    9 +++++
 5 files changed, 48 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/2d2b85f9/helix-admin-webapp/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosRest.java
----------------------------------------------------------------------
diff --git a/helix-admin-webapp/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosRest.java
b/helix-admin-webapp/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosRest.java
index 2be7e9c..073f35b 100644
--- a/helix-admin-webapp/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosRest.java
+++ b/helix-admin-webapp/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosRest.java
@@ -630,6 +630,15 @@ public class TestHelixAdminScenariosRest extends AdminTestBase
 
     accessor = _startCMResultMap.get("localhost_1232")._manager.getHelixDataAccessor();
     LiveInstance leader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
+    for(int i = 0; i < 5; i++)
+    {
+      if(leader != null)
+      {
+        break;
+      }
+      Thread.sleep(1000);
+      leader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
+    }
     Assert.assertTrue(leader.getInstanceName().startsWith("controller_900"));
 
     boolean verifyResult =

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/2d2b85f9/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java
b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java
index b46fd3f..c2f107b 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java
@@ -148,14 +148,14 @@ public class TestEnablePartitionDuringDisable extends ZkIntegrationTestBase
 
     // ensure we get 1 slaveToOffline and 1 offlineToSlave after disable partition
     long startT = System.currentTimeMillis();
-    while (System.currentTimeMillis() - startT < 1000)  // retry in 1s
+    while (System.currentTimeMillis() - startT < 10000)  // retry in 5s
     {
       if (transition.slaveToOfflineCnt > 0 && transition.offlineToSlave > 0)
       {
         break;
       }
 
-      Thread.sleep(10);
+      Thread.sleep(100);
     }
     long endT = System.currentTimeMillis();
     System.out.println("1 disable and re-enable took: " + (endT - startT) + "ms");

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/2d2b85f9/helix-core/src/test/java/org/apache/helix/integration/TestMessagingService.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestMessagingService.java
b/helix-core/src/test/java/org/apache/helix/integration/TestMessagingService.java
index 6ba40dc..4ed22ba 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestMessagingService.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestMessagingService.java
@@ -343,7 +343,7 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
     cr.setSessionSpecific(false);
     AsyncCallback callback1 = new MockAsyncCallback();
     int messageSent1 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback1, 2000);
+        .sendAndWait(cr, msg, callback1, 10000);
 
     AssertJUnit.assertTrue(callback1.getMessageReplied().get(0).getRecord()
         .getMapField(Message.Attributes.MESSAGE_RESULT.toString())
@@ -358,26 +358,26 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
     cr.setPartition("TestDB_17");
     AsyncCallback callback3 = new MockAsyncCallback();
     int messageSent3 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback3, 2000);
+        .sendAndWait(cr, msg, callback3, 10000);
     AssertJUnit.assertTrue(callback3.getMessageReplied().size() == _replica - 1);
 
 
     cr.setPartition("TestDB_15");
     AsyncCallback callback4 = new MockAsyncCallback();
     int messageSent4 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback4, 2000);
+        .sendAndWait(cr, msg, callback4, 10000);
     AssertJUnit.assertTrue(callback4.getMessageReplied().size() == _replica);
     
     cr.setPartitionState("SLAVE");
     AsyncCallback callback5 = new MockAsyncCallback();
     int messageSent5 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback5, 2000);
+        .sendAndWait(cr, msg, callback5, 10000);
     AssertJUnit.assertTrue(callback5.getMessageReplied().size() == _replica - 1);
     
     cr.setDataSource(DataSource.IDEALSTATES);
     AsyncCallback callback6 = new MockAsyncCallback();
     int messageSent6 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback6, 2000);
+        .sendAndWait(cr, msg, callback6, 10000);
     AssertJUnit.assertTrue(callback6.getMessageReplied().size() == _replica - 1);
   }
 
@@ -411,7 +411,7 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
     cr.setSelfExcluded(false);
     AsyncCallback callback1 = new MockAsyncCallback();
     int messageSent1 = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback1, 3000);
+        .sendAndWait(cr, msg, callback1, 10000);
 
     AssertJUnit.assertTrue(callback1.getMessageReplied().size() == NODE_NR);
     AssertJUnit.assertTrue(callback1.getMessageReplied().get(0).getRecord()
@@ -448,7 +448,7 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
 
     AsyncCallback callback1 = new MockAsyncCallback();
     int messagesSent = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback1, 2000);
+        .sendAndWait(cr, msg, callback1, 10000);
 
     AssertJUnit.assertTrue(callback1.getMessageReplied().get(0).getRecord()
         .getMapField(Message.Attributes.MESSAGE_RESULT.toString())
@@ -460,7 +460,7 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
     cr.setPartition("TestDB_17");
     AsyncCallback callback2 = new MockAsyncCallback();
     messagesSent = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback2, 2000);
+        .sendAndWait(cr, msg, callback2, 10000);
     AssertJUnit.assertTrue(callback2.getMessageReplied().get(0).getRecord()
         .getMapField(Message.Attributes.MESSAGE_RESULT.toString())
         .get("ControllerResult").indexOf(hostSrc) != -1);
@@ -472,7 +472,7 @@ public class TestMessagingService extends ZkStandAloneCMTestBaseWithPropertyServ
     cr.setPartitionState("SLAVE");
     AsyncCallback callback3 = new MockAsyncCallback();
     messagesSent = _startCMResultMap.get(hostSrc)._manager.getMessagingService()
-        .sendAndWait(cr, msg, callback3, 2000);
+        .sendAndWait(cr, msg, callback3, 10000);
     AssertJUnit.assertTrue(callback3.getMessageReplied().get(0).getRecord()
         .getMapField(Message.Attributes.MESSAGE_RESULT.toString())
         .get("ControllerResult").indexOf(hostSrc) != -1);

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/2d2b85f9/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
b/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
index b928367..2ee8a02 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestSchedulerMessage.java
@@ -173,20 +173,31 @@ public class TestSchedulerMessage extends ZkStandAloneCMTestBaseWithPropertyServ
     Assert.assertEquals(_PARTITIONS, _factory._results.size());
     PropertyKey controllerTaskStatus = keyBuilder.controllerTaskStatus(
         MessageType.SCHEDULER_MSG.toString(), schedulerMessage.getMsgId());
-    ZNRecord statusUpdate = helixDataAccessor.getProperty(controllerTaskStatus)
-        .getRecord();
-    Assert.assertTrue(statusUpdate.getMapField("SentMessageCount")
-        .get("MessageCount").equals("" + (_PARTITIONS * 3)));
+      
     int messageResultCount = 0;
-    for(String key : statusUpdate.getMapFields().keySet())
+    for(int i = 0; i < 10; i++)
     {
-      if(key.startsWith("MessageResult "))
+      ZNRecord statusUpdate = helixDataAccessor.getProperty(controllerTaskStatus)
+          .getRecord();
+      Assert.assertTrue(statusUpdate.getMapField("SentMessageCount")
+          .get("MessageCount").equals("" + (_PARTITIONS * 3)));
+      for(String key : statusUpdate.getMapFields().keySet())
       {
-        messageResultCount ++;
+        if(key.startsWith("MessageResult "))
+        {
+          messageResultCount ++;
+        }
+      }
+      if(messageResultCount == _PARTITIONS * 3)
+      {
+        break;
+      }
+      else
+      {
+        Thread.sleep(2000);
       }
     }
     Assert.assertEquals(messageResultCount, _PARTITIONS * 3);
-    
     int count = 0;
     for (Set<String> val : _factory._results.values())
     {

http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/2d2b85f9/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosCli.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosCli.java
b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosCli.java
index 1d9bb2f..9dd41a3 100644
--- a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosCli.java
+++ b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminScenariosCli.java
@@ -366,6 +366,15 @@ public class TestHelixAdminScenariosCli extends ZkIntegrationTestBase
     
     accessor = _startCMResultMap.get("localhost_1232")._manager.getHelixDataAccessor();
     LiveInstance leader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
+    for(int i = 0; i < 5; i++)
+    {
+      if(leader != null)
+      {
+        break;
+      }
+      Thread.sleep(1000);
+      leader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
+    }
     Assert.assertTrue(leader.getInstanceName().startsWith("controller_900"));
     
     boolean verifyResult =


Mime
View raw message