You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:49:48 UTC

[44/50] brooklyn-server git commit: Add DynamicClusterTest.testDoNotQuarantineFailedEntities

Add DynamicClusterTest.testDoNotQuarantineFailedEntities

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/408296cb
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/408296cb
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/408296cb

Branch: refs/heads/0.6.0
Commit: 408296cbbecf2061b6ceba5294be29f5e43e2f9b
Parents: 0230712
Author: Aled Sage <al...@gmail.com>
Authored: Fri Nov 15 10:53:28 2013 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Fri Nov 15 10:53:28 2013 +0000

----------------------------------------------------------------------
 .../entity/group/DynamicClusterTest.groovy      | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/408296cb/core/src/test/java/brooklyn/entity/group/DynamicClusterTest.groovy
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/group/DynamicClusterTest.groovy b/core/src/test/java/brooklyn/entity/group/DynamicClusterTest.groovy
index 1e113d7..c482922 100644
--- a/core/src/test/java/brooklyn/entity/group/DynamicClusterTest.groovy
+++ b/core/src/test/java/brooklyn/entity/group/DynamicClusterTest.groovy
@@ -398,6 +398,37 @@ class DynamicClusterTest {
     }
 
     @Test
+    public void testDoNotQuarantineFailedEntities() {
+        final int failNum = 2
+        final AtomicInteger counter = new AtomicInteger(0)
+        DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
+                // default is quarantineFailedEntities==false in 0.6.x
+                //.configure("quarantineFailedEntities", false)
+                .configure("initialSize", 0)
+                .configure("factory", { properties ->
+                    int num = counter.incrementAndGet();
+                    return new FailingEntity(properties, (num==failNum))
+                }));
+
+        cluster.start([loc])
+        
+        // no quarantine group, as a child
+        assertEquals(cluster.getChildren().size(), 0, "children="+cluster.getChildren())
+        
+        // Failed node will not be a member or child
+        cluster.resize(3)
+        assertEquals(cluster.currentSize, 2)
+        assertEquals(cluster.getMembers().size(), 2)
+        assertEquals(cluster.getChildren().size(), 2, "children="+cluster.getChildren())
+        
+        // Failed node will not be managed either
+        assertEquals(Iterables.size(Iterables.filter(cluster.getChildren(), Predicates.instanceOf(FailingEntity.class))), 2)
+        for (Entity member : cluster.getMembers()) {
+            assertFalse(((FailingEntity)member).failOnStart)
+        }
+    }
+
+    @Test
     public void defaultRemovalStrategyShutsDownNewestFirstWhenResizing() {
         TestEntity entity
         final int failNum = 2