You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2017/09/19 14:57:35 UTC
[1/2] brooklyn-server git commit: fix non-det failure in scaling down
test
Repository: brooklyn-server
Updated Branches:
refs/heads/master d5f9ae48b -> 8c69a7d99
fix non-det failure in scaling down test
ensuring that policy doesn't start before size reaches 6,
and fix execution context bug found in autoscaler changing pool size
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2cc9dafb
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2cc9dafb
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2cc9dafb
Branch: refs/heads/master
Commit: 2cc9dafb5151dbf6ebbda2d209a78f77236e6962
Parents: c9f7b0d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Sat Sep 16 03:23:00 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Sep 16 03:25:36 2017 +0100
----------------------------------------------------------------------
.../policy/autoscaling/AutoScalerPolicy.java | 4 ++--
.../autoscaling/AutoScalerPolicyPoolSizeTest.java | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2cc9dafb/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java
----------------------------------------------------------------------
diff --git a/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java b/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java
index baa3871..0b33760 100644
--- a/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java
+++ b/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java
@@ -768,8 +768,8 @@ public class AutoScalerPolicy extends AbstractPolicy {
int desiredSize = Math.min(max, Math.max(min, currentSize));
if (currentSize != desiredSize) {
- if (LOG.isInfoEnabled()) LOG.info("{} resizing pool {} immediateley from {} to {} (due to new pool size limits)", new Object[] {this, poolEntity, currentSize, desiredSize});
- getResizeOperator().resize(poolEntity, desiredSize);
+ if (LOG.isInfoEnabled()) LOG.info("{} resizing pool {} triggering resize computation due to new pool size limits, current {} exceeds bound of {}", new Object[] {this, poolEntity, currentSize, desiredSize});
+ resizeNow("Size "+currentSize+" not in new bounds");
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2cc9dafb/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
index b03c194..16325d2 100644
--- a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
+++ b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java
@@ -30,6 +30,8 @@ import org.apache.brooklyn.core.test.entity.TestCluster;
import org.apache.brooklyn.core.test.entity.TestSizeRecordingCluster;
import org.apache.brooklyn.entity.stock.BasicStartable;
import org.apache.brooklyn.util.collections.MutableList;
+import org.apache.brooklyn.util.time.Duration;
+import org.apache.brooklyn.util.time.Time;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
@@ -64,7 +66,7 @@ public class AutoScalerPolicyPoolSizeTest extends BrooklynAppUnitTestSupport {
.configure(AutoScalerPolicy.RESIZE_OPERATOR, new ResizeOperator() {
@Override
public Integer resize(Entity entity, Integer desiredSize) {
- LOG.info("resizing to " + desiredSize);
+ LOG.info("test policy resizing to " + desiredSize);
resizes.add(desiredSize);
return ((Resizable) entity).resize(desiredSize);
}
@@ -101,10 +103,18 @@ public class AutoScalerPolicyPoolSizeTest extends BrooklynAppUnitTestSupport {
@Test
public void testResizeDown() throws Exception {
EntityAsserts.assertAttributeEqualsEventually(cluster, TestCluster.GROUP_SIZE, CLUSTER_INIITIAL_SIZE);
+ // temporarily increase, otherwise the policy can sometimes kick in to resize down before size 6 is reached
+ policy.config().set(AutoScalerPolicy.MAX_POOL_SIZE, CLUSTER_MAX_SIZE + 2);
cluster.resize(CLUSTER_MAX_SIZE + 2);
+ EntityAsserts.assertAttributeEqualsEventually(cluster, TestSizeRecordingCluster.SIZE_HISTORY_RECORD_COUNT, 2);
+ Assert.assertEquals((int)cluster.getSizeHistory().get(0), CLUSTER_INIITIAL_SIZE, "history: "+cluster.getSizeHistory());
+ Assert.assertEquals((int)cluster.getSizeHistory().get(1), CLUSTER_MAX_SIZE + 2, "history: "+cluster.getSizeHistory());
+
+ policy.config().set(AutoScalerPolicy.MIN_POOL_SIZE, CLUSTER_MAX_SIZE);
+ policy.config().set(AutoScalerPolicy.MAX_POOL_SIZE, CLUSTER_MAX_SIZE);
EntityAsserts.assertAttributeEqualsEventually(cluster, TestSizeRecordingCluster.SIZE_HISTORY_RECORD_COUNT, 3);
- Assert.assertEquals((int)cluster.getSizeHistory().get(0), CLUSTER_INIITIAL_SIZE);
- Assert.assertEquals((int)cluster.getSizeHistory().get(1), CLUSTER_MAX_SIZE + 2);
- Assert.assertEquals((int)cluster.getSizeHistory().get(2), CLUSTER_MAX_SIZE);
+ Assert.assertEquals((int)cluster.getSizeHistory().get(0), CLUSTER_INIITIAL_SIZE, "history: "+cluster.getSizeHistory());
+ Assert.assertEquals((int)cluster.getSizeHistory().get(1), CLUSTER_MAX_SIZE + 2, "history: "+cluster.getSizeHistory());
+ Assert.assertEquals((int)cluster.getSizeHistory().get(2), CLUSTER_MAX_SIZE, "history: "+cluster.getSizeHistory());
}
}
[2/2] brooklyn-server git commit: This closes #825
Posted by al...@apache.org.
This closes #825
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/8c69a7d9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/8c69a7d9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/8c69a7d9
Branch: refs/heads/master
Commit: 8c69a7d9920a4785c185bd8aa350d6f4315ffeb6
Parents: d5f9ae4 2cc9daf
Author: Aled Sage <al...@gmail.com>
Authored: Tue Sep 19 15:57:24 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Sep 19 15:57:24 2017 +0100
----------------------------------------------------------------------
.../policy/autoscaling/AutoScalerPolicy.java | 4 ++--
.../autoscaling/AutoScalerPolicyPoolSizeTest.java | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------