You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/04/28 13:53:43 UTC

[05/10] brooklyn-server git commit: backoff more slowly when checking assertions, cause tests to run a bit quicker

backoff more slowly when checking assertions, cause tests to run a bit quicker


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

Branch: refs/heads/master
Commit: bd461adb4e0ebf882cbbedd55f4c6a7b6b54ebca
Parents: bf69b0c
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Apr 25 16:08:13 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 28 14:09:51 2017 +0100

----------------------------------------------------------------------
 .../common/src/main/java/org/apache/brooklyn/test/Asserts.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bd461adb/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index 443d42b..b5cdcbc 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -993,7 +993,10 @@ public class Asserts {
                 }
                 long sleepTime = Math.min(sleepTimeBetweenAttempts, expireTime-System.currentTimeMillis());
                 if (sleepTime > 0) Thread.sleep(sleepTime);
-                sleepTimeBetweenAttempts = Math.min(sleepTimeBetweenAttempts*2, maxPeriod.toMilliseconds());
+                sleepTimeBetweenAttempts = Math.min(
+                    // grow by 1.5x; doubling causes longer extra waits than we like in tests
+                    sleepTimeBetweenAttempts + Math.max(1, sleepTimeBetweenAttempts/2), 
+                    maxPeriod.toMilliseconds());
             }
             
             log.info("succeedsEventually exceeded max attempts or timeout - {} attempts lasting {} ms, for {}", new Object[] {attempt, System.currentTimeMillis()-startTime, c});