From 74d610c0b4f7285b4aebc4528bc2d281738354ca Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Wed, 7 Dec 2022 16:14:11 +0100 Subject: Scale down slightly more aggressively Don't require a minimum number of measurements as we might not be able to ever collect them fast enough within the scaling window. --- .../hosted/provision/autoscale/AutoscalingTest.java | 19 +++++++++++++++++++ .../maintenance/AutoscalingMaintainerTest.java | 6 +++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'node-repository/src/test') diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java index ff72d22bb39..eda677c6e59 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java @@ -77,6 +77,25 @@ public class AutoscalingTest { fixture.autoscale()); } + @Test + public void test_container_scaling_down_exclusive() { + var min = new ClusterResources(2, 1, new NodeResources(4, 8, 50, 0.1)); + var now = new ClusterResources(8, 1, new NodeResources(4, 8, 50, 0.1)); + var max = new ClusterResources(8, 1, new NodeResources(4, 8, 50, 0.1)); + var fixture = AutoscalingTester.fixture() + .awsProdSetup(false) + .clusterType(ClusterSpec.Type.container) + .initialResources(Optional.of(now)) + .capacity(Capacity.from(min, max)) + .build(); + fixture.tester().setScalingDuration(fixture.applicationId(), fixture.clusterSpec.id(), Duration.ofMinutes(5)); + + fixture.loader().applyLoad(new Load(0.01, 0.38, 0), 5); + fixture.tester().assertResources("Scaling down", + 2, 1, 4, 8, 50, + fixture.autoscale()); + } + @Test public void initial_deployment_with_host_sharing_flag() { var min = new ClusterResources(7, 1, new NodeResources(2.0, 10.0, 384.0, 0.1)); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java index 2d05754d96e..5ceb28d3fed 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java @@ -178,7 +178,11 @@ public class AutoscalingMaintainerTest { } assertEquals(Cluster.maxScalingEvents, tester.cluster(app1, cluster1).scalingEvents().size()); - assertEquals("The latest rescaling is the last event stored", + + // Complete last event + tester.addMeasurements(0.1f, 0.1f, 0.1f, 20, 1, app1); + tester.maintainer().maintain(); + assertEquals("Last event is completed", tester.clock().instant(), tester.cluster(app1, cluster1).scalingEvents().get(Cluster.maxScalingEvents - 1).completion().get()); } -- cgit v1.2.3