summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMorten Tokle <mortent@verizonmedia.com>2020-09-01 07:53:05 +0200
committerMorten Tokle <mortent@verizonmedia.com>2020-09-01 11:27:39 +0200
commitf603ecd5cd6a2a654f5b724c4edf49df79652dd9 (patch)
tree90eae75fa392402a283865e85634a4a9c94ba392 /controller-api
parentc9af34109b06aa90154ee1692717a0fed555ec61 (diff)
Include test report in job run details
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java8
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TestReport.java21
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java13
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java11
6 files changed, 57 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
index 418d1089428..8d1f608a31c 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/RunDataStore.java
@@ -17,7 +17,13 @@ public interface RunDataStore {
/** Stores the given log for the given deployment job. */
void put(RunId id, byte[] log);
- /** Deletes the run logs for the given deployment job. */
+ /** Returns the test report og the given deployment job, if present */
+ Optional<byte[]> getTestReport(RunId id);
+
+ /** Stores the test report for the given deployment job */
+ void putTestReport(RunId id, byte[] report);
+
+ /** Deletes the run logs and test report for the given deployment job. */
void delete(RunId id);
/** Deletes all data associated with the given application. */
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
index 9ad9324e216..317b29cf621 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
@@ -10,8 +10,8 @@ import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData
import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.serviceview.bindings.ApplicationView;
@@ -121,4 +121,5 @@ public interface ConfigServer {
/** Is tester node ready */
boolean isTesterReady(DeploymentId deployment);
+ Optional<TestReport> getTestReport(DeploymentId deployment);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TestReport.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TestReport.java
new file mode 100644
index 00000000000..25c3ca398f1
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TestReport.java
@@ -0,0 +1,21 @@
+// Copyright Verizon Media. 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;
+
+/**
+ * @author mortent
+ */
+public class TestReport {
+ private final String report;
+
+ private TestReport(String report) {
+ this.report = report;
+ }
+
+ public String toJson() {
+ return report;
+ }
+
+ public static TestReport fromJson(String report) {
+ return new TestReport(report);
+ }
+}
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 b33917abcbe..bc4a618aecf 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
@@ -37,6 +37,9 @@ public interface TesterCloud {
/** Returns the host name of the given CNAME, if any. */
Optional<HostName> resolveCname(HostName hostName);
+ /** Returns the test report as JSON if available */
+ Optional<TestReport> getTestReport(DeploymentId deploymentId);
+
enum Status {
/** Tests have not yet started. */
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
index 16874f996a5..e579ce54de1 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockRunDataStore.java
@@ -15,6 +15,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class MockRunDataStore implements RunDataStore {
private final Map<RunId, byte[]> logs = new ConcurrentHashMap<>();
+ private final Map<RunId, byte[]> reports = new ConcurrentHashMap<>();
@Override
public Optional<byte[]> get(RunId id) {
@@ -27,13 +28,25 @@ public class MockRunDataStore implements RunDataStore {
}
@Override
+ public Optional<byte[]> getTestReport(RunId id) {
+ return Optional.ofNullable(reports.get(id));
+ }
+
+ @Override
+ public void putTestReport(RunId id, byte[] report) {
+ reports.put(id, report);
+ }
+
+ @Override
public void delete(RunId id) {
logs.remove(id);
+ reports.remove(id);
}
@Override
public void delete(ApplicationId id) {
logs.keySet().removeIf(runId -> runId.application().equals(id));
+ reports.keySet().removeIf(runId -> runId.application().equals(id));
}
}
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 eb5360bc4bc..cd710c611d4 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
@@ -4,6 +4,7 @@ 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.TestReport;
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;
@@ -25,6 +26,7 @@ public class MockTesterCloud implements TesterCloud {
private List<LogEntry> log = new ArrayList<>();
private Status status = NOT_STARTED;
private byte[] config;
+ private Optional<TestReport> testReport = Optional.empty();
public MockTesterCloud(NameService nameService) {
this.nameService = nameService;
@@ -66,6 +68,15 @@ public class MockTesterCloud implements TesterCloud {
.map(record -> HostName.from(record.data().asString().substring(0, record.data().asString().length() - 1)));
}
+ @Override
+ public Optional<TestReport> getTestReport(DeploymentId deploymentId) {
+ return testReport;
+ }
+
+ public void testReport(TestReport testReport) {
+ this.testReport = Optional.ofNullable(testReport);
+ }
+
public void add(LogEntry entry) {
log.add(entry);
}