summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2020-03-05 13:06:52 +0100
committerGitHub <noreply@github.com>2020-03-05 13:06:52 +0100
commiteaeb10e29953aff69267f634351c26993d3b06e7 (patch)
treeb196c75f1cb784c2fd536f3d5eaec4c4af9a6111 /controller-api
parent916e3950a7ec137bf213134a6a4ca1c365110dde (diff)
parent057227e623d661fe6f2e6fdb9c04614b5194e008 (diff)
Merge pull request #12450 from vespa-engine/jvenstad/integration-test-deployments-with-new-deploy-path
Jvenstad/integration test deployments with new deploy path
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java26
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java43
2 files changed, 22 insertions, 47 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
index a1c4d379b6c..b8f52694b67 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
@@ -1,11 +1,14 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
+import com.yahoo.config.provision.HostName;
+import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import java.net.URI;
import java.util.List;
+import java.util.Optional;
/**
* Allows running some predefined tests -- typically remotely.
@@ -15,40 +18,25 @@ import java.util.List;
public interface TesterCloud {
/** Signals the tester to run its tests. */
- void startTests(URI testerUrl, Suite suite, byte[] config);
-
- /** Signals the tester to run its tests. */
void startTests(DeploymentId deploymentId, Suite suite, byte[] config);
/** Returns the log entries from the tester with ids after the given threshold. */
- List<LogEntry> getLog(URI testerUrl, long after);
-
- /** Returns the log entries from the tester with ids after the given threshold. */
List<LogEntry> getLog(DeploymentId deploymentId, long after);
/** Returns the current status of the tester. */
- Status getStatus(URI testerUrl);
-
- /** Returns the current status of the tester. */
Status getStatus(DeploymentId deploymentId);
/** Returns whether the container is ready to serve. */
boolean ready(URI endpointUrl);
/** Returns whether the test container is ready to serve */
- boolean testerReady(URI endpointUrl);
-
- /** Returns whether the test container is ready to serve */
boolean testerReady(DeploymentId deploymentId);
- /** Returns whether the given URL is registered in DNS. */
- boolean exists(URI endpointUrl);
+ /** Returns the IP address of the given host name, if any. */
+ Optional<String> resolveHostName(HostName hostname);
- /**
- * Returns whether the given URL is registered in DNS. Always returns true,
- * as endpoints are not use in this case
- */
- default boolean exists(DeploymentId deploymentId) { return true; }
+ /** Returns the host name of the given CNAME, if any. */
+ Optional<HostName> resolveCname(HostName hostName);
enum Status {
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
index d2914f95360..eb5360bc4bc 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
@@ -1,13 +1,18 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.stubs;
+import com.yahoo.config.provision.HostName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
+import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService;
+import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
+import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud.Status.NOT_STARTED;
@@ -15,28 +20,20 @@ import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Teste
public class MockTesterCloud implements TesterCloud {
+ private final NameService nameService;
+
private List<LogEntry> log = new ArrayList<>();
private Status status = NOT_STARTED;
private byte[] config;
- private URI testerUrl;
- @Override
- public void startTests(URI testerUrl, Suite suite, byte[] config) {
- this.status = RUNNING;
- this.config = config;
- this.testerUrl = testerUrl;
+ public MockTesterCloud(NameService nameService) {
+ this.nameService = nameService;
}
@Override
public void startTests(DeploymentId deploymentId, Suite suite, byte[] config) {
this.status = RUNNING;
this.config = config;
- this.testerUrl = null;
- }
-
- @Override
- public List<LogEntry> getLog(URI testerUrl, long after) {
- return log.stream().filter(entry -> entry.id() > after).collect(Collectors.toList());
}
@Override
@@ -45,9 +42,6 @@ public class MockTesterCloud implements TesterCloud {
}
@Override
- public Status getStatus(URI testerUrl) { return status; }
-
- @Override
public Status getStatus(DeploymentId deploymentId) { return status; }
@Override
@@ -56,23 +50,20 @@ public class MockTesterCloud implements TesterCloud {
}
@Override
- public boolean testerReady(URI testerUrl) {
- return true;
- }
-
- @Override
public boolean testerReady(DeploymentId deploymentId) {
return true;
}
@Override
- public boolean exists(URI endpointUrl) {
- return true;
+ public Optional<String> resolveHostName(HostName hostname) {
+ return Optional.of("1.2.3.4");
}
@Override
- public boolean exists(DeploymentId deploymentId) {
- return true;
+ public Optional<HostName> resolveCname(HostName hostName) {
+ return nameService.findRecords(Record.Type.CNAME, RecordName.from(hostName.value())).stream()
+ .findFirst()
+ .map(record -> HostName.from(record.data().asString().substring(0, record.data().asString().length() - 1)));
}
public void add(LogEntry entry) {
@@ -87,8 +78,4 @@ public class MockTesterCloud implements TesterCloud {
return config;
}
- public URI testerUrl() {
- return testerUrl;
- }
-
}