brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m4rkmckenna <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #803: Adds cluster.max.size to dynamic cluster
Date Tue, 22 Aug 2017 09:26:13 GMT
Github user m4rkmckenna commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/803#discussion_r134428127
  
    --- Diff: core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
---
    @@ -1378,6 +1378,24 @@ public void testChildCommandPermitNotReleasedWhenMemberStartTaskCancelledBeforeS
             assertEquals(clusterImpl.getChildTaskSemaphore().availablePermits(), 1);
         }
     
    +    @Test
    +    public void testClusterMaxSize() {
    +        DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class)
    +                .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TestEntity.class))
    +                .configure(DynamicCluster.INITIAL_SIZE, 2)
    +                .configure(DynamicCluster.MAX_SIZE, 6));
    +        cluster.start(ImmutableList.of(loc));
    +
    +        cluster.resize(4);
    +        EntityAsserts.assertAttributeEqualsEventually(cluster, DynamicCluster.GROUP_SIZE,
4);
    +        try {
    +            cluster.resize(8);
    +            Asserts.shouldHaveFailedPreviously("Cluster resize should have failed because
max size was exceeded");
    +        } catch (Exception e) {
    +            // ignored.
    --- End diff --
    
    You could assert that the expected exception is thown ... Empty catch blocks is a code
smell


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message