summaryrefslogtreecommitdiffstats
path: root/controller-api/src
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2020-01-30 12:10:27 +0100
committerMartin Polden <mpolden@mpolden.no>2020-01-30 12:35:11 +0100
commitd6bc119e2b074e07ffa9f340cb289bd912300d26 (patch)
treed0aeb4b64579dff1971653deaf1befa2574e20a2 /controller-api/src
parent2533470181c45a877fdc884f1c6742e0934aa6bb (diff)
Query routing generator when zone explicitly supports shared routing
Diffstat (limited to 'controller-api/src')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java
index a7dc5f81bc0..cd0e6552596 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java
@@ -1,8 +1,10 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.routing;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
+import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import java.net.URI;
import java.util.List;
@@ -27,17 +29,19 @@ public class RoutingGeneratorMock implements RoutingGenerator {
private final Map<DeploymentId, List<RoutingEndpoint>> routingTable = new ConcurrentHashMap<>();
private final List<RoutingEndpoint> defaultEndpoints;
+ private final ZoneRegistry zoneRegistry;
- public RoutingGeneratorMock() {
- this(List.of());
- }
-
- public RoutingGeneratorMock(List<RoutingEndpoint> endpoints) {
+ public RoutingGeneratorMock(List<RoutingEndpoint> endpoints, ZoneRegistry zoneRegistry) {
this.defaultEndpoints = List.copyOf(endpoints);
+ this.zoneRegistry = zoneRegistry;
}
@Override
public List<RoutingEndpoint> endpoints(DeploymentId deployment) {
+ if (!zoneRegistry.zones().routingMethod(RoutingMethod.shared).ids().contains(deployment.zoneId())) {
+ throw new IllegalArgumentException(deployment.zoneId() + " does not support routing method " +
+ RoutingMethod.shared);
+ }
if (routingTable.isEmpty()) return defaultEndpoints;
return routingTable.getOrDefault(deployment, List.of());
}