Aled Sage created BROOKLYN-291:
----------------------------------

             Summary: Manually setting service.isUp is overwritten by enricher 
(causing non-deterministic test failures)
                 Key: BROOKLYN-291
                 URL: https://issues.apache.org/jira/browse/BROOKLYN-291
             Project: Brooklyn
          Issue Type: Bug
    Affects Versions: 0.9.0
            Reporter: Aled Sage


If one creates an entity and explicitly sets its service.isUp to true, then the 
default enrichers can override this value to remove it. This is because it is 
executing concurrently, and if service-up-indicators is null then it removes 
the service.isUp sensor value!

A similar thing happens for the service.state sensor.

This is non-deterministic, but can be demonstrate with this simple test:

{noformat}
for (int i = 0; i < 100; i++) {
    TestEntity entity = app.addChild(EntitySpec.create(TestEntity.class));
    entity.sensors().set(TestEntity.SERVICE_UP, true);
    entity.sensors().set(TestEntity.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
    Thread.sleep(10);
    assertEquals(entity.sensors().get(TestEntity.SERVICE_UP), Boolean.TRUE);
    assertEquals(entity.sensors().get(TestEntity.SERVICE_STATE_ACTUAL), 
Lifecycle.RUNNING);
}
{noformat}

Most entities don't explicitly set the service.isUp, so it has not been a 
problem in production systems. However, it does impact tests - it is the likely 
cause of many non-deterministic test failures.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to