aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-05-22 09:13:17 +0200
committerHarald Musum <musum@yahooinc.com>2023-05-22 09:13:17 +0200
commit0ecb4dee6b60e27e1e697f9b2d3d76b316c94cad (patch)
tree8f786c758f3c3bf00d14d858d23ff17209319495 /config-model/src/test
parent2e60561db6885a04714d6d4ed530d90ae77296a5 (diff)
Test provisioning more than one node in dev
Test quota calculation and downscaling for nodes in dev by requiring 2 number of nodes in a content cluster in dev. Also change message to be separate between max resources being over quota and resources used being over quota.
Diffstat (limited to 'config-model/src/test')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java42
1 files changed, 33 insertions, 9 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
index 1a7b3d62cb7..f6410aff581 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
@@ -21,6 +21,7 @@ public class QuotaValidatorTest {
private final Zone publicZone = new Zone(SystemName.Public, Environment.prod, RegionName.from("foo"));
private final Zone publicCdZone = new Zone(SystemName.PublicCd, Environment.prod, RegionName.from("foo"));
+ private final Zone devZone = new Zone(SystemName.Public, Environment.dev, RegionName.from("foo"));
private final Quota quota = Quota.unlimited().withClusterSize(10).withBudget(BigDecimal.valueOf(1.25));
@Test
@@ -47,7 +48,7 @@ public class QuotaValidatorTest {
tester.deploy(null, getServices("testCluster", 10), Environment.prod, null);
fail();
} catch (RuntimeException e) {
- assertEquals("The max resources specified cost $1.63 but your quota is $1.25: Contact support to upgrade your plan.", e.getMessage());
+ assertEquals("The resources used cost $1.63 but your quota is $1.25: Contact support to upgrade your plan.", e.getMessage());
}
}
@@ -58,7 +59,7 @@ public class QuotaValidatorTest {
tester.deploy(null, getServices("testCluster", 10), Environment.prod, null);
fail();
} catch (RuntimeException e) {
- assertEquals("publiccd: The max resources specified cost $1.63 but your quota is $1.00: Contact support to upgrade your plan.", e.getMessage());
+ assertEquals("publiccd: The resources used cost $1.63 but your quota is $1.00: Contact support to upgrade your plan.", e.getMessage());
}
}
@@ -69,8 +70,30 @@ public class QuotaValidatorTest {
tester.deploy(null, getServices("testCluster", 10), Environment.prod, null);
fail();
} catch (RuntimeException e) {
- assertEquals("publiccd: The max resources specified cost $1.63 but your quota is $1.25: Contact support to upgrade your plan.", e.getMessage());
+ assertEquals("publiccd: The resources used cost $1.63 but your quota is $1.25: Contact support to upgrade your plan.", e.getMessage());
+ }
+ }
+
+
+ @Test
+ void test_deploy_above_quota_budget_in_dev() {
+ var quota = Quota.unlimited().withBudget(BigDecimal.valueOf(0.01));
+ var tester = new ValidationTester(5, false, new TestProperties().setHostedVespa(true).setQuota(quota).setZone(devZone));
+ // There is downscaling to 1 node per cluster in dev
+ try {
+ tester.deploy(null, getServices("testCluster", 2, false), Environment.dev, null);
+ fail();
+ } catch (RuntimeException e) {
+ assertEquals("The resources used cost $0.16 but your quota is $0.01: Contact support to upgrade your plan.", e.getMessage());
+ }
+
+ // Override so that we will get 2 nodes in content cluster
+ try {
+ tester.deploy(null, getServices("testCluster", 2, true), Environment.dev, null);
+ fail();
+ } catch (RuntimeException e) {
+ assertEquals("The resources used cost $0.33 but your quota is $0.01: Contact support to upgrade your plan.", e.getMessage());
}
}
@@ -82,22 +105,23 @@ public class QuotaValidatorTest {
tester.deploy(null, getServices("testCluster", 10), Environment.prod, null);
fail();
} catch (RuntimeException e) {
- assertEquals("The max resources specified cost $-.-- but your quota is $--.--: Please free up some capacity.",
+ assertEquals("The resources used cost $-.-- but your quota is $--.--: Please free up some capacity.",
ValidationTester.censorNumbers(e.getMessage()));
}
}
private static String getServices(String contentClusterId, int nodeCount) {
- return "<services version='1.0'>" +
+ return getServices(contentClusterId, nodeCount, false);
+ }
+
+ private static String getServices(String contentClusterId, int nodeCount, boolean devOverride) {
+ return "<services version='1.0' xmlns:deploy='vespa' xmlns:preprocess='properties'>" +
" <content id='" + contentClusterId + "' version='1.0'>" +
" <redundancy>1</redundancy>" +
- " <engine>" +
- " <proton/>" +
- " </engine>" +
" <documents>" +
" <document type='music' mode='index'/>" +
" </documents>" +
- " <nodes count='" + nodeCount + "'>" +
+ " <nodes count='" + nodeCount + "' " + (devOverride ? "required='true'" : "") + " >\n" +
" <resources vcpu=\"[0.5, 2]\" memory=\"[1Gb, 6Gb]\" disk=\"[1Gb, 18Gb]\"/>\n" +
" </nodes>" +
" </content>" +