Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/61#discussion_r14806334
  
    --- Diff: core/src/test/java/brooklyn/entity/group/DynamicClusterTest.java 
---
    @@ -514,10 +514,18 @@ public void 
defaultRemovalStrategyShutsDownNewestFirstWhenResizing() throws Exce
             assertEquals(cluster.getCurrentSize(), (Integer)2);
             assertEquals(ImmutableSet.copyOf(cluster.getMembers()), 
ImmutableSet.copyOf(creationOrder), "actual="+cluster.getMembers());
     
    +        Collection<Entity> preStopMembers = 
ImmutableList.copyOf(cluster.getMembers());
    +
             // Now stop one
             cluster.resize(1);
             assertEquals(cluster.getCurrentSize(), (Integer)1);
    -        assertEquals(ImmutableList.copyOf(cluster.getMembers()), 
creationOrder.subList(0, 1));
    +
    +        //Make sure we stopped the entity with the earliest creation time
    +        //Could be multiple entities with identical creation time, pick 
any.
    +        Entity remainingEntity = cluster.getMembers().iterator().next();
    +        for(Entity entity : preStopMembers) {
    +            assertTrue(entity.getCreationTime() >= 
remainingEntity.getCreationTime());
    +        }
    --- End diff --
    
    looks to me like the only way `creationOrder.subList(0,1)` would fail is if 
their creation times are identical (ie to nearest millisecond).  i don't think 
there are issues with "older" one being deleted in that situation.  but maybe 
so that we can have *both* checks (the new time one, and the original `subList` 
one) we should stick a `Time.sleep(Duration.millis(1))` before the `resize(2)` ?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to