brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [1/7] incubator-brooklyn git commit: Fixes SERVICE_UP timeout error in tests
Date Wed, 07 Jan 2015 14:50:45 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 7c35d202a -> 7eb1d541f


Fixes SERVICE_UP timeout error in tests

Fixes "Caused by: java.lang.IllegalStateException: Timeout waiting for SERVICE_UP from MyServiceImpl"
MyServiceImpl is setting SERVICE_UP manually while the enrichers toggle it in parallel in
response to the SERVICE_STATE_ACTUAL changes. Sometimes the enricher will trigger in the window
between MyServiceImpl setting the value to true and calling waitForServiceUp, leading to the
timeout error.


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

Branch: refs/heads/master
Commit: 6ce9ba57efbd821a3b633b1c0759196cd9799090
Parents: 67d05d6
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Tue Dec 23 18:49:12 2014 +0200
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Wed Jan 7 14:00:52 2015 +0200

----------------------------------------------------------------------
 .../brooklyn/entity/basic/SoftwareProcessEntityTest.java    | 5 +++++
 .../brooklyn/entity/basic/lifecycle/ScriptHelperTest.java   | 9 +--------
 2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6ce9ba57/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
b/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
index 3a9e544..b2a7993 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
@@ -350,6 +350,11 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport
{
         public MyServiceImpl(Entity parent) { super(parent); }
 
         @Override
+        protected void initEnrichers() {
+            // Don't add enrichers messing with the SERVICE_UP state - we are setting it
manually
+        }
+
+        @Override
         public Class<?> getDriverInterface() { return SimulatedDriver.class; }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6ce9ba57/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
index bdb49b7..971e22c 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
@@ -72,14 +72,9 @@ public class ScriptHelperTest extends BrooklynAppUnitTestSupport {
     public void testCheckRunningForcesInessential() {
         MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class, MyServiceInessentialDriverImpl.class));
         
-        // is set false on mgmt starting (probably shouldn't be though)
-        Assert.assertFalse(entity.getAttribute(Startable.SERVICE_UP));
-        
         entity.start(ImmutableList.of(loc));
         SimulatedInessentialIsRunningDriver driver = (SimulatedInessentialIsRunningDriver)
entity.getDriver();
         Assert.assertTrue(driver.isRunning());
-        // currently, is initially set true after successful start
-        Assert.assertTrue(entity.getAttribute(Startable.SERVICE_UP));
         
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
true);
         EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true);
@@ -88,16 +83,14 @@ public class ScriptHelperTest extends BrooklynAppUnitTestSupport {
         
         driver.setFailExecution(true);
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
false);
-        EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, false);
         
         log.debug("caught failure, now clear");
         driver.setFailExecution(false);
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
true);
-        EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true);
     }
     
     public static class MyServiceInessentialDriverImpl extends MyServiceImpl {
-        
+
         @Override public Class<?> getDriverInterface() {
             return SimulatedInessentialIsRunningDriver.class;
         }


Mime
View raw message