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/09/26 09:43:32 UTC

[2/3] brooklyn-server git commit: apply start timeout to unit test as better way to prevent race failures

apply start timeout to unit test as better way to prevent race failures

as per @aledsage's comment at https://github.com/apache/brooklyn-server/pull/329


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

Branch: refs/heads/master
Commit: 61784c1a7a62e618f5e05a151aad015a98d9ec1f
Parents: 5481664
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Sep 26 10:22:30 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Sep 26 10:22:30 2016 +0100

----------------------------------------------------------------------
 .../software/base/SoftwareProcessStopsDuringStartTest.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/61784c1a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessStopsDuringStartTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessStopsDuringStartTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessStopsDuringStartTest.java
index 3c79f17..a5d7ec0 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessStopsDuringStartTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessStopsDuringStartTest.java
@@ -56,6 +56,7 @@ import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -76,7 +77,8 @@ public class SoftwareProcessStopsDuringStartTest extends BrooklynAppUnitTestSupp
     public void setUp() throws Exception {
         super.setUp();
         loc = mgmt.getLocationManager().createLocation(LocationSpec.create(DelayedProvisioningLocation.class));
-        entity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class));
+        entity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)
+            .configure(EmptySoftwareProcess.START_TIMEOUT, Asserts.DEFAULT_SHORT_TIMEOUT));
         executor = Executors.newCachedThreadPool();
     }
     
@@ -171,9 +173,8 @@ public class SoftwareProcessStopsDuringStartTest extends BrooklynAppUnitTestSupp
             // might fail, depending how far it got before stop completed
             LOG.info("start() failed during concurrent stop; acceptable", e);
         } catch (TimeoutException e) {
-            // TODO we should fail on this, tidy up so start always returns immediately when stopped
-            // (instead it seems to sit there waiting 2m for isUp)
-            LOG.warn("start() timed out during concurrent stop; acceptable, but test should be fixed", e);
+            // with shorter timeout this shouldn't occur (26 Sept 2016)
+            Assert.fail("start() timed out during concurrent stop; acceptable, but test should be fixed", e);
         }
         
         assertEquals(loc.getCalls(), ImmutableList.of("obtain", "release"));