diff options
author | Harald Musum <musum@verizonmedia.com> | 2023-04-13 15:32:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 15:32:01 +0200 |
commit | 448cb119eeea60c5f83b196dc11e5a6d9c9bc7d2 (patch) | |
tree | dd389a7b89d1196def14647271d5e47db9755783 /controller-api/src | |
parent | 565247a0a315561aa033efe3af283fa1b3e3444e (diff) | |
parent | f95354bf26d37b9cca812d49c10e3f8d95899c5d (diff) |
Merge pull request #26731 from vespa-engine/hmusum/verify-plan-on-submit
Verify plan when submitting an application
Diffstat (limited to 'controller-api/src')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/PlanRegistryMock.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/PlanRegistryMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/PlanRegistryMock.java index ecce9b7ccfa..a389f771db6 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/PlanRegistryMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/PlanRegistryMock.java @@ -42,11 +42,15 @@ public class PlanRegistryMock implements PlanRegistry { private final boolean supported; public MockPlan(String planId, boolean billed, boolean supported, double cpuPrice, double memPrice, double dgbPrice, int quota, String description) { - this(PlanId.from(planId), billed, supported, new MockCostCalculator(cpuPrice, memPrice, dgbPrice), () -> Quota.unlimited().withBudget(quota), description); + this(PlanId.from(planId), billed, supported, new MockCostCalculator(cpuPrice, memPrice, dgbPrice), () -> createQuota(quota), description); + } + + private static Quota createQuota(int quota) { + return quota == 0 ? Quota.zero() : Quota.unlimited().withBudget(quota); } public MockPlan(String planId, boolean billed, boolean supported, String cpuPrice, String memPrice, String dgbPrice, int quota, String description) { - this(PlanId.from(planId), billed, supported, new MockCostCalculator(cpuPrice, memPrice, dgbPrice), () -> Quota.unlimited().withBudget(quota), description); + this(PlanId.from(planId), billed, supported, new MockCostCalculator(cpuPrice, memPrice, dgbPrice), () -> createQuota(quota), description); } public MockPlan(PlanId planId, boolean billed, boolean supported, MockCostCalculator calculator, QuotaCalculator quota, String description) { |