brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [5/8] git commit: Simplify HighAvailabilityManagerSplitBrainTest
Date Sun, 07 Sep 2014 21:28:54 GMT
Simplify HighAvailabilityManagerSplitBrainTest


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/85f547e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/85f547e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/85f547e9

Branch: refs/heads/master
Commit: 85f547e96d20d33aa36a3713c4d9b0ee3809a135
Parents: 287947a
Author: Aled Sage <aled.sage@gmail.com>
Authored: Fri Sep 5 20:14:02 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri Sep 5 21:52:51 2014 +0100

----------------------------------------------------------------------
 .../ha/HighAvailabilityManagerSplitBrainTest.java   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/85f547e9/core/src/test/java/brooklyn/management/ha/HighAvailabilityManagerSplitBrainTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/management/ha/HighAvailabilityManagerSplitBrainTest.java
b/core/src/test/java/brooklyn/management/ha/HighAvailabilityManagerSplitBrainTest.java
index a11e57f..f83816e 100644
--- a/core/src/test/java/brooklyn/management/ha/HighAvailabilityManagerSplitBrainTest.java
+++ b/core/src/test/java/brooklyn/management/ha/HighAvailabilityManagerSplitBrainTest.java
@@ -23,12 +23,10 @@ import static org.testng.Assert.assertEquals;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -44,12 +42,12 @@ import brooklyn.entity.rebind.persister.PersistMode;
 import brooklyn.entity.rebind.persister.PersistenceObjectStore;
 import brooklyn.location.Location;
 import brooklyn.management.internal.ManagementContextInternal;
+import brooklyn.test.Asserts;
 import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.collections.MutableList;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.repeat.Repeater;
 import brooklyn.util.time.Duration;
 import brooklyn.util.time.Time;
 
@@ -313,8 +311,8 @@ public class HighAvailabilityManagerSplitBrainTest {
 
         try {
             final Stopwatch timer = Stopwatch.createStarted();
-            Assert.assertTrue(Repeater.create().backoff(Duration.millis(1), 1.2, Duration.millis(50)).limitTimeTo(Duration.THIRTY_SECONDS).until(new
Callable<Boolean>() {
-                @Override public Boolean call() throws Exception {
+            Asserts.succeedsEventually(new Runnable() {
+                @Override public void run() {
                     ManagementPlaneSyncRecord memento = nodes.get(0).ha.getManagementPlaneSyncState();
                     int masters=0, standbys=0, savedMasters=0, savedStandbys=0;
                     for (HaMgmtNode n: nodes) {
@@ -334,9 +332,11 @@ public class HighAvailabilityManagerSplitBrainTest {
                         log.warn("we seem to have a problem stabilizing");  //handy place
to set a suspend-VM breakpoint!
                         timer.stop();
                     }
-                    return masters==1 && standbys==nodes.size()-1 && savedMasters==1
&& savedStandbys==nodes.size()-1;
-                }
-            }).run());
+                    assertEquals(masters, 1);
+                    assertEquals(standbys, nodes.size()-1);
+                    assertEquals(savedMasters, 1);
+                    assertEquals(savedStandbys, nodes.size()-1);
+                }});
         } catch (Throwable t) {
             log.warn("Failed to stabilize (rethrowing): "+t, t);
             throw Exceptions.propagate(t);


Mime
View raw message