Updated Branches:
refs/heads/master ca1ef9108 -> 18d2e6362
HELIX-41: fix intermittent 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/18d2e636
Tree: http://git-wip-us.apache.org/repos/asf/incubator-helix/tree/18d2e636
Diff: http://git-wip-us.apache.org/repos/asf/incubator-helix/diff/18d2e636
Branch: refs/heads/master
Commit: 18d2e636279f77af87dbc19dd3da2ba9132e040e
Parents: ca1ef91
Author: zzhang <zzhang5@uci.edu>
Authored: Sun Feb 3 18:31:48 2013 -0800
Committer: zzhang <zzhang5@uci.edu>
Committed: Sun Feb 3 18:31:48 2013 -0800
----------------------------------------------------------------------
.../helix/healthcheck/TestAlertFireHistory.java | 20 +++++++++------
1 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/18d2e636/helix-core/src/test/java/org/apache/helix/healthcheck/TestAlertFireHistory.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/healthcheck/TestAlertFireHistory.java
b/helix-core/src/test/java/org/apache/helix/healthcheck/TestAlertFireHistory.java
index 7159a87..d8254bd 100644
--- a/helix-core/src/test/java/org/apache/helix/healthcheck/TestAlertFireHistory.java
+++ b/helix-core/src/test/java/org/apache/helix/healthcheck/TestAlertFireHistory.java
@@ -290,15 +290,19 @@ public class TestAlertFireHistory extends ZkStandAloneCMTestBaseWithPropertyServ
setHealthData(metricsx, metricsy);
task.run();
- Thread.sleep(100);
- history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
-
- Assert.assertEquals(history.getMapFields().size(), 30);
- recordMap = new TreeMap<String, Map<String, String>>();
- recordMap.putAll( history.getMapFields());
- lastRecord = recordMap.lastEntry().getValue();
+ for (int j = 0; j < 10; j++) {
+ Thread.sleep(100);
+ history = helixDataAccessor.getProperty(keyBuilder.alertHistory()).getRecord();
+ recordMap = new TreeMap<String, Map<String, String>>();
+ recordMap.putAll( history.getMapFields());
+ lastRecord = recordMap.lastEntry().getValue();
+
+ if (history.getMapFields().size() == 30 && lastRecord.size() == 10)
+ break;
+ }
+ Assert.assertEquals(history.getMapFields().size(), 30, "expect history.map-field size
is 30, but was " + history);
+ Assert.assertEquals(lastRecord.size() , 10, "expect last-record size is 10, but was
" + lastRecord);
- Assert.assertEquals(lastRecord.size() , 10);
if(x == 0)
{
Assert.assertTrue(lastRecord.get("(localhost_12922.TestStat@DB#db1.TestMetric2)GREATER(100)").equals("ON"));
|