aboutsummaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/test/java/com/yahoo/config
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2023-05-31 08:42:55 +0200
committerGitHub <noreply@github.com>2023-05-31 08:42:55 +0200
commitaf827dc5256e1372033ada8de82f3858f9db7dc0 (patch)
tree4e85cfb9e6ccf30a6672ea54857c501679e399de /config-provisioning/src/test/java/com/yahoo/config
parent8714d5cdce3f9e6f7a995688deb3f6432c35356d (diff)
parent64ef5c1850f07d3a5569f485b2c3777bbb3daaf4 (diff)
Merge pull request #27214 from vespa-engine/jonmv/custom-host-ttl
Jonmv/custom host ttl
Diffstat (limited to 'config-provisioning/src/test/java/com/yahoo/config')
-rw-r--r--config-provisioning/src/test/java/com/yahoo/config/provision/CapacityTest.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/config-provisioning/src/test/java/com/yahoo/config/provision/CapacityTest.java b/config-provisioning/src/test/java/com/yahoo/config/provision/CapacityTest.java
index a7614bbc016..b3d2e0afa7d 100644
--- a/config-provisioning/src/test/java/com/yahoo/config/provision/CapacityTest.java
+++ b/config-provisioning/src/test/java/com/yahoo/config/provision/CapacityTest.java
@@ -3,9 +3,11 @@ package com.yahoo.config.provision;
import org.junit.jupiter.api.Test;
+import java.time.Duration;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
/**
@@ -35,20 +37,23 @@ public class CapacityTest {
new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 5)),
new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
- // It's enough than one dimension is smaller also when the others are larger
+ // It's enough that one dimension is smaller also when the others are larger
assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
new ClusterResources(8, 4, new NodeResources(2, 1, 6, 8)));
+
+ assertEquals("Cannot set hostTTL without a custom cloud account",
+ assertThrows(IllegalArgumentException.class,
+ () -> Capacity.from(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
+ new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
+ IntRange.empty(), false, true, Optional.empty(), new ClusterInfo.Builder().hostTTL(Duration.ofSeconds(1)).build()))
+ .getMessage());
}
private void assertValidationFailure(ClusterResources min, ClusterResources max) {
- try {
- Capacity.from(min, max, IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty());
- fail("Expected exception with min " + min + " and max " + max);
- }
- catch (IllegalArgumentException e) {
- assertEquals("The max capacity must be larger than the min capacity, but got min " + min + " and max " + max,
- e.getMessage());
- }
+ assertEquals("The max capacity must be larger than the min capacity, but got min " + min + " and max " + max,
+ assertThrows(IllegalArgumentException.class,
+ () -> Capacity.from(min, max, IntRange.empty(), false, true, Optional.empty(), ClusterInfo.empty()))
+ .getMessage());
}
}