diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2021-11-25 14:02:03 +0100 |
---|---|---|
committer | Morten Tokle <mortent@verizonmedia.com> | 2021-11-25 14:02:03 +0100 |
commit | 8485d1312a9765aeb708c0b6407370eab6c24d47 (patch) | |
tree | f78305eb465c63735007313cdbc12c9299124c2e /config-model | |
parent | 8efdf6eebf3ec7d350d26c0ec2db6dab8a8f2794 (diff) |
Add system name
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java | 2 | ||||
-rwxr-xr-x | config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java | 54 |
2 files changed, 47 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index f7e8afc2d94..083a5308386 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -210,6 +210,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat for(String suffix : deployState.getProperties().zoneDnsSuffixes()) { // L4 ApplicationClusterEndpoint.DnsName l4Name = ApplicationClusterEndpoint.DnsName.sharedL4NameFrom( + deployState.zone().system(), ClusterSpec.Id.from(getName()), deployState.getProperties().applicationId(), suffix); @@ -223,6 +224,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat // L7 ApplicationClusterEndpoint.DnsName l7Name = ApplicationClusterEndpoint.DnsName.sharedNameFrom( + deployState.zone().system(), ClusterSpec.Id.from(getName()), deployState.getProperties().applicationId(), suffix); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java index 2016cea02a9..07ccc356c18 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java @@ -42,6 +42,8 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import static com.yahoo.config.provision.SystemName.cd; +import static com.yahoo.config.provision.SystemName.main; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasKey; @@ -358,32 +360,66 @@ public class ContainerClusterTest { @Test public void generatesCorrectRoutingInfo() { - - assertNames(ApplicationId.from("t1", "a1", "i1"), + // main system: + assertNames(main, + ApplicationId.from("t1", "a1", "i1"), Set.of(), List.of("search-cluster.i1.a1.t1.endpoint.suffix", "search-cluster--i1--a1--t1.endpoint.suffix")); - assertNames(ApplicationId.from("t1", "a1", "default"), + assertNames(main, + ApplicationId.from("t1", "a1", "default"), Set.of(), List.of("search-cluster.a1.t1.endpoint.suffix", "search-cluster--a1--t1.endpoint.suffix")); - assertNames(ApplicationId.from("t1", "default", "default"), + assertNames(main, + ApplicationId.from("t1", "default", "default"), Set.of(), List.of("search-cluster.default.t1.endpoint.suffix", "search-cluster--default--t1.endpoint.suffix")); - assertNames(ApplicationId.from("t1", "a1", "default"), + assertNames(main, + ApplicationId.from("t1", "a1", "default"), Set.of(new ContainerEndpoint("not-in-this-cluster", ApplicationClusterEndpoint.Scope.global, List.of("foo", "bar"))), List.of("search-cluster.a1.t1.endpoint.suffix", "search-cluster--a1--t1.endpoint.suffix")); - assertNames(ApplicationId.from("t1", "a1", "default"), + assertNames(main, + ApplicationId.from("t1", "a1", "default"), Set.of(new ContainerEndpoint("search-cluster", ApplicationClusterEndpoint.Scope.global, List.of("rotation-1.x.y.z", "rotation-2.x.y.z")), new ContainerEndpoint("search-cluster", ApplicationClusterEndpoint.Scope.application, List.of("app-rotation.x.y.z"))), List.of("search-cluster.a1.t1.endpoint.suffix", "search-cluster--a1--t1.endpoint.suffix", "rotation-1.x.y.z", "rotation-2.x.y.z", "app-rotation.x.y.z")); + + // cd system: + assertNames(cd, + ApplicationId.from("t1", "a1", "i1"), + Set.of(), + List.of("search-cluster.cd.i1.a1.t1.endpoint.suffix", "search-cluster--cd--i1--a1--t1.endpoint.suffix")); + + assertNames(cd, + ApplicationId.from("t1", "a1", "default"), + Set.of(), + List.of("search-cluster.cd.a1.t1.endpoint.suffix", "search-cluster--cd--a1--t1.endpoint.suffix")); + + assertNames(cd, + ApplicationId.from("t1", "default", "default"), + Set.of(), + List.of("search-cluster.cd.default.t1.endpoint.suffix", "search-cluster--cd--default--t1.endpoint.suffix")); + + assertNames(cd, + ApplicationId.from("t1", "a1", "default"), + Set.of(new ContainerEndpoint("not-in-this-cluster", ApplicationClusterEndpoint.Scope.global, List.of("foo", "bar"))), + List.of("search-cluster.cd.a1.t1.endpoint.suffix", "search-cluster--cd--a1--t1.endpoint.suffix")); + + assertNames(cd, + ApplicationId.from("t1", "a1", "default"), + Set.of(new ContainerEndpoint("search-cluster", ApplicationClusterEndpoint.Scope.global, List.of("rotation-1.x.y.z", "rotation-2.x.y.z")), + new ContainerEndpoint("search-cluster", ApplicationClusterEndpoint.Scope.application, List.of("app-rotation.x.y.z"))), + List.of("search-cluster.cd.a1.t1.endpoint.suffix", "search-cluster--cd--a1--t1.endpoint.suffix", "rotation-1.x.y.z", "rotation-2.x.y.z", "app-rotation.x.y.z")); + } - private void assertNames(ApplicationId appId, Set<ContainerEndpoint> globalEndpoints, List<String> expectedNames) { + private void assertNames(SystemName systemName, ApplicationId appId, Set<ContainerEndpoint> globalEndpoints, List<String> expectedNames) { + Zone zone = new Zone(systemName, Environment.defaultEnvironment(), RegionName.defaultName()); DeployState state = new DeployState.Builder() - .zone(Zone.defaultZone()) + .zone(zone) .endpoints(globalEndpoints) .properties(new TestProperties() .setHostedVespa(true) @@ -396,7 +432,7 @@ public class ContainerClusterTest { cluster.doPrepare(state); List<ApplicationClusterEndpoint> endpoints = cluster.endpoints(); assertEquals(expectedNames.size(), endpoints.size()); - expectedNames.forEach(expected -> assertTrue("Endpoint not matched " + expected, endpoints.stream().anyMatch(e -> Objects.equals(e.dnsName().value(), expected)))); + expectedNames.forEach(expected -> assertTrue("Endpoint not matched " + expected + " was: " + endpoints, endpoints.stream().anyMatch(e -> Objects.equals(e.dnsName().value(), expected)))); } private void verifyTesterApplicationInstalledBundles(Zone zone, List<String> expectedBundleNames) { |