Test scaling back down
@@ -6,7 +6,6 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.NodeResources;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
@@ -15,7 +14,7 @@ import static org.junit.Assert.assertTrue;
public class AutoscalingTest {
@Test
- public void testAutoscalingNodeCount() {
+ public void testAutoscaling() {
NodeResources resources = new NodeResources(3, 100, 100, 1);
AutoscalingTester tester = new AutoscalingTester(resources);
@@ -31,9 +30,18 @@ public class AutoscalingTest {
assertTrue("Too few metrics -> No change", tester.autoscale(application1, cluster1).isEmpty());
tester.addMeasurements( 0.3f, 60, application1);
- tester.assertResources("Scaling to more nodes since we spend too much cpu and can't increase node size",
+ tester.assertResources("Scaling up since resource usage is too high",
10, 2.5, 23.8, 23.8,
tester.autoscale(application1, cluster1));
+
+ tester.assertResources("No new info -> Same result",
+ 10, 2.5, 23.8, 23.8,
+ tester.autoscale(application1, cluster1));
+
+ tester.addMeasurements( 0.1f, 120, application1);
+ tester.assertResources("Scale down since resource usage has gone down",
+ 10, 1.7, 15.9, 15.9,
+ tester.autoscale(application1, cluster1));
}
}
