summaryrefslogtreecommitdiffstats
path: root/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2023-03-10 21:17:27 +0100
committerGitHub <noreply@github.com>2023-03-10 21:17:27 +0100
commitb06d77bb7433d750fbc02446bab00af8c6ce7fcc (patch)
treedb65ad25564969fa542b028523025e7f10e20604 /node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
parentde3b08fab085a2356d12db594e8c04476eeb4cb1 (diff)
parent7ddc151bec7b736db6d3f15f1c32f77d0115784c (diff)
Merge pull request #26403 from vespa-engine/bratseth/autoscaling-completion
Bratseth/autoscaling completion
Diffstat (limited to 'node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java')
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
index 2786da4b69e..e6c183d02ce 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainerTest.java
@@ -58,10 +58,11 @@ public class ScalingSuggestionsMaintainerTest {
tester.deploy(app1, cluster1, Capacity.from(new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()));
+ storeCompletion(app1, cluster1.id(), tester.nodeRepository());
tester.deploy(app2, cluster2, Capacity.from(new ClusterResources(5, 1, new NodeResources(4, 4, 10, 0.1)),
new ClusterResources(10, 1, new NodeResources(6.5, 5, 15, 0.1)),
IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()));
-
+ storeCompletion(app2, cluster2.id(), tester.nodeRepository());
tester.clock().advance(Duration.ofHours(13));
Duration timeAdded = addMeasurements(0.90f, 0.90f, 0.90f, 0, 500, app1, tester.nodeRepository());
tester.clock().advance(timeAdded.negated());
@@ -109,6 +110,16 @@ public class ScalingSuggestionsMaintainerTest {
assertFalse("Suggestion is not made as it matches what we have", shouldSuggest(app1, cluster1, tester));
}
+ private void storeCompletion(ApplicationId appId, ClusterSpec.Id clusterId, NodeRepository nodeRepository) {
+ try (var lock = nodeRepository.applications().lock(appId)) {
+ var app = nodeRepository.applications().require(appId);
+ var cluster = app.cluster(clusterId).get();
+ cluster = cluster.with(cluster.lastScalingEvent().get().withCompletion(nodeRepository.clock().instant()));
+ app = app.with(cluster);
+ nodeRepository.applications().put(app, lock);
+ }
+ }
+
private Autoscaling suggestionOf(ApplicationId app, ClusterSpec cluster, ProvisioningTester tester) {
return tester.nodeRepository().applications().get(app).get().cluster(cluster.id()).get().suggested();
}