diff options
author | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-11-30 20:20:22 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-11-30 20:20:22 +0100 |
commit | e43bf39e6ec973297649f7e462b37e5aec8f155f (patch) | |
tree | ab81b1a3aafc564d382dc51a6a809a2ccf43ee71 /flags/src/test | |
parent | fa4302626526d3dcba9aa93825392ee24e2bf7e4 (diff) |
Support lower bound on number of shared hosts
Adds a 'minCount' field to the shared host jackson flag, denoting the minimum
number of "shared hosts" that must exist, otherwise the deficit will be
provisioned by DynamicProvisioningMaintainer.
A "shared host" is one that is considered for allocation if current tenant node
allocations were removed: It must be a tenant host, cannot be an exclusiveTo
host, etc.
minCount requires the setting of (at least one) shared host.
Diffstat (limited to 'flags/src/test')
-rw-r--r-- | flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java | 3 | ||||
-rw-r--r-- | flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java | 25 |
2 files changed, 27 insertions, 1 deletions
diff --git a/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java b/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java index 636eea2c33c..6b043ea5a89 100644 --- a/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java +++ b/flags/src/test/java/com/yahoo/vespa/flags/FlagsTest.java @@ -114,7 +114,8 @@ public class FlagsTest { SharedHost sharedHost = new SharedHost(List.of(new HostResources( 4.0, 16.0, 50.0, 0.3, "fast", "local", - 10))); + 10)), + null); testGeneric(Flags.SHARED_HOST, sharedHost); } diff --git a/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java b/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java new file mode 100644 index 00000000000..f0a11f244a4 --- /dev/null +++ b/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java @@ -0,0 +1,25 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.flags.custom; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class SharedHostTest { + @Test + public void serialization() throws IOException { + verifySerialization(new SharedHost(List.of(new HostResources(1.0, 2.0, 3.0, 4.0, "fast", "remote", 5)), 6)); + verifySerialization(new SharedHost(List.of(new HostResources(1.0, 2.0, 3.0, 4.0, "fast", "remote", 5)), null)); + } + + private void verifySerialization(SharedHost sharedHost) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(sharedHost); + SharedHost deserialized = mapper.readValue(json, SharedHost.class); + assertEquals(sharedHost, deserialized); + } +}
\ No newline at end of file |