diff options
Diffstat (limited to 'controller-server/src/test')
4 files changed, 37 insertions, 17 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java index 53af74bf542..95e71e4d63a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java @@ -3,15 +3,16 @@ package com.yahoo.vespa.hosted.controller; import com.google.inject.Inject; import com.yahoo.component.AbstractComponent; -import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.ZoneId; +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.time.Duration; +import java.time.Instant; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -67,28 +68,44 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public Optional<ZoneId> getZone(Environment environment, RegionName region) { - return zones().stream().filter(z -> z.environment().equals(environment) && - z.region().equals(region)).findFirst(); + public boolean hasZone(ZoneId zoneId) { + return zones.contains(zoneId); } @Override - public List<URI> getConfigServerUris(Environment environment, RegionName region) { - return getZone(environment, region) - .map(z -> URI.create(String.format("http://cfg.%s.%s.test", environment.value(), region.value()))) - .map(Collections::singletonList) - .orElse(Collections.emptyList()); + public List<URI> getConfigServerUris(ZoneId zoneId) { + return Collections.singletonList(URI.create(String.format("http://cfg.%s.test", zoneId.value()))); } @Override - public Optional<URI> getLogServerUri(Environment environment, RegionName region) { - return getZone(environment, region) - .map(z -> URI.create(String.format("http://log.%s.%s.test", environment.value(), region.value()))); + public List<URI> getConfigServerSecureUris(ZoneId zoneId) { + return Collections.singletonList(URI.create(String.format("https://cfg.%s.test:4443", zoneId.value()))); } @Override - public Optional<Duration> getDeploymentTimeToLive(Environment environment, RegionName region) { - return Optional.ofNullable(deploymentTimeToLive.get(ZoneId.from(environment, region))); + public Optional<URI> getLogServerUri(DeploymentId deploymentId) { + if ( ! hasZone(deploymentId.zoneId())) + return Optional.empty(); + + String kibanaQuery = "/#/discover?_g=()&_a=(columns:!(_source)," + + "index:'logstash-*',interval:auto," + + "query:(query_string:(analyze_wildcard:!t,query:'" + + "HV-tenant:%22" + deploymentId.applicationId().tenant().value() + "%22%20" + + "AND%20HV-application:%22" + deploymentId.applicationId().application().value() + "%22%20" + + "AND%20HV-region:%22" + deploymentId.zoneId().region().value() + "%22%20" + + "AND%20HV-instance:%22" + deploymentId.applicationId().instance().value() + "%22%20" + + "AND%20HV-environment:%22" + deploymentId.zoneId().environment().value() + "%22'))," + + "sort:!('@timestamp',desc))"; + + URI kibanaPath = URI.create(kibanaQuery); + return Optional.of(URI.create(String.format("http://log.%s.test", deploymentId.zoneId().value())).resolve(kibanaPath)); + } + + @Override + public Duration getDeploymentTimeToLive(ZoneId zoneId) { + return deploymentTimeToLive.containsKey(zoneId) + ? deploymentTimeToLive.get(zoneId) + : Duration.ofMillis(Long.MAX_VALUE / 2); } @Override @@ -97,9 +114,9 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public URI getMonitoringSystemUri(Environment environment, RegionName name, ApplicationId application) { - return URI.create("http://monitoring-system.test/?environment=" + environment.value() + "®ion=" - + name.value() + "&application=" + application.toShortString()); + public URI getMonitoringSystemUri(DeploymentId deploymentId) { + return URI.create("http://monitoring-system.test/?environment=" + deploymentId.zoneId().environment().value() + "®ion=" + + deploymentId.zoneId().region().value() + "&application=" + deploymentId.applicationId().toShortString()); } @Override diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json index 9174e7dd8b2..e251b03e548 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment.json @@ -12,6 +12,7 @@ "version": "(ignore)", "revision": "(ignore)", "deployTimeEpochMs": "(ignore)", + "expiryTimeEpochMs": "(ignore)", "screwdriverId": "123", "gitRepository": "repository1", "gitBranch": "master", diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-west-1.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-west-1.json index 062f4408518..50575afa69d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-west-1.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-west-1.json @@ -14,6 +14,7 @@ "version": "6.1.0", "revision": "(ignore)", "deployTimeEpochMs": "(ignore)", + "expiryTimeEpochMs": "(ignore)", "screwdriverId": "123", diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-corp-us-east-1.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-corp-us-east-1.json index 75b257da0ed..fdff97c6b1b 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-corp-us-east-1.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/prod-corp-us-east-1.json @@ -18,6 +18,7 @@ "version": "6.1.0", "revision": "(ignore)", "deployTimeEpochMs": "(ignore)", + "expiryTimeEpochMs": "(ignore)", "screwdriverId": "123", "gitRepository": "repository1", "gitBranch": "master", |