aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-11-16 12:06:51 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-11-16 12:06:51 +0100
commitb388f96ca0fbafa7c3d703d69ce97a65156ebbdf (patch)
tree457def23a0598cbe93f90d5f650bf0e681e36811 /controller-server/src/main
parente2fa647910b94521466f96cd25ac0e8b6542e7f8 (diff)
Let developers run prod tests against non-default instances
Diffstat (limited to 'controller-server/src/main')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index ef129dd76f7..9b42a1e590d 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -2044,17 +2044,18 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
/** Returns test config for indicated job, with production deployments of the default instance. */
private HttpResponse testConfig(ApplicationId id, JobType type) {
- // TODO jonmv: Support non-default instances as well; requires API change in clients.
- ApplicationId defaultInstanceId = TenantAndApplicationId.from(id).defaultInstance();
+ Application application = controller.applications().requireApplication(TenantAndApplicationId.from(id));
+ ApplicationId prodInstanceId = application.deploymentSpec().instance(id.instance()).isPresent()
+ ? id : TenantAndApplicationId.from(id).defaultInstance();
HashSet<DeploymentId> deployments = controller.applications()
- .getInstance(defaultInstanceId).stream()
- .flatMap(instance -> instance.productionDeployments().keySet().stream())
- .map(zone -> new DeploymentId(defaultInstanceId, zone))
- .collect(Collectors.toCollection(HashSet::new));
- var testedZone = type.zone(controller.system());
-
- // If a production job is specified, the production deployment of the _default instance_ is the relevant one,
- // as user instances should not exist in prod. TODO jonmv: Remove this when multiple instances are supported (above).
+ .getInstance(prodInstanceId).stream()
+ .flatMap(instance -> instance.productionDeployments().keySet().stream())
+ .map(zone -> new DeploymentId(prodInstanceId, zone))
+ .collect(Collectors.toCollection(HashSet::new));
+ ZoneId testedZone = type.zone(controller.system());
+
+ // If a production job is specified, the production deployment of the orchestrated instance is the relevant one,
+ // as user instances should not exist in prod.
if ( ! type.isProduction())
deployments.add(new DeploymentId(id, testedZone));