summaryrefslogtreecommitdiffstats
path: root/node-repository/src/test/java/com/yahoo
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-07-18 14:26:00 +0200
committerJon Bratseth <bratseth@gmail.com>2022-07-18 14:26:00 +0200
commitdde3daae88460f558060edb9912664de5a062b40 (patch)
tree28bd3ce8194151628220220234a279edd03ffabe /node-repository/src/test/java/com/yahoo
parent9b944fb02e8c0819059080026592ccdf137d35b2 (diff)
Use fixture and handle just 1 node
Diffstat (limited to 'node-repository/src/test/java/com/yahoo')
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java18
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java5
2 files changed, 9 insertions, 14 deletions
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 9e79949efb6..b512852a5e7 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
@@ -563,21 +563,11 @@ public class AutoscalingTest {
@Test
public void test_autoscaling_in_dev() {
- NodeResources resources = new NodeResources(1, 4, 50, 1);
- ClusterResources min = new ClusterResources( 1, 1, resources);
- ClusterResources max = new ClusterResources(3, 1, resources);
- Capacity capacity = Capacity.from(min, max, false, true);
-
- AutoscalingTester tester = new AutoscalingTester(Environment.dev, resources.withVcpu(resources.vcpu() * 2));
- ApplicationId application1 = AutoscalingTester.applicationId("application1");
- ClusterSpec cluster1 = AutoscalingTester.clusterSpec(ClusterSpec.Type.container, "cluster1");
-
- tester.deploy(application1, cluster1, capacity);
- tester.addQueryRateMeasurements(application1, cluster1.id(),
- 500, t -> 100.0);
- tester.addCpuMeasurements(1.0f, 1f, 10, application1);
+ var fixture = AutoscalingTester.fixture().zone(new Zone(Environment.dev, RegionName.from("us-east"))).build();
+ fixture.tester().clock().advance(Duration.ofDays(2));
+ fixture.applyLoad(1.0, 1.0, 1.0, 200);
assertTrue("Not attempting to scale up because policies dictate we'll only get one node",
- tester.autoscale(application1, cluster1, capacity).target().isEmpty());
+ fixture.autoscale().target().isEmpty());
}
/** Same setup as test_autoscaling_in_dev(), just with required = true */
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
index 602b6189898..efdeab4e6ee 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
@@ -126,6 +126,11 @@ public class Fixture {
Zone zone = new Zone(Environment.prod, RegionName.from("us-east"));
HostResourcesCalculator resourceCalculator = new AutoscalingTester.MockHostResourcesCalculator(zone, 0);
+ public Fixture.Builder zone(Zone zone) {
+ this.zone = zone;
+ return this;
+ }
+
public Fixture.Builder clusterType(ClusterSpec.Type type) {
cluster = ClusterSpec.request(type, cluster.id()).vespaVersion("7").build();
return this;