summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-06-10 13:48:38 +0200
committerjonmv <venstad@gmail.com>2022-06-10 13:48:38 +0200
commit85381f1ba40251e6a9c3773586867f7d2e4b20ec (patch)
tree71be7a5add58f76a579fdcdd2d3e070c50f51b64 /controller-server
parent073c4eec84043026e83803e0138660c184f96d8c (diff)
Add additional data to test runtime
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java14
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json3
-rw-r--r--controller-server/src/test/resources/testConfig.json3
7 files changed, 41 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index 894b175961b..813e3454e80 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -608,6 +608,9 @@ public class InternalStepRunner implements StepRunner {
byte[] config = testConfigSerializer.configJson(id.application(),
id.type(),
true,
+ deployment.get().version(),
+ deployment.get().revision(),
+ deployment.get().at(),
endpoints,
controller.applications().reachableContentClustersByZone(deployments));
controller.jobController().cloud().startTests(getTesterDeploymentId(id), suite, config);
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java
index 1680e064234..2394f293170 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.deployment;
+import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
@@ -8,10 +9,12 @@ import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
import com.yahoo.slime.SlimeUtils;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.time.Instant;
import java.util.List;
import java.util.Map;
@@ -31,6 +34,9 @@ public class TestConfigSerializer {
public Slime configSlime(ApplicationId id,
JobType type,
boolean isCI,
+ Version platform,
+ RevisionId revision,
+ Instant deployedAt,
Map<ZoneId, List<Endpoint>> deployments,
Map<ZoneId, List<String>> clusters) {
Slime slime = new Slime();
@@ -40,6 +46,9 @@ public class TestConfigSerializer {
root.setString("zone", type.zone().value());
root.setString("system", system.value());
root.setBool("isCI", isCI);
+ root.setString("platform", platform.toFullString());
+ root.setLong("revision", revision.number());
+ root.setLong("deployedAt", deployedAt.toEpochMilli());
// TODO jvenstad: remove when clients can be updated
Cursor endpointsObject = root.setObject("endpoints");
@@ -72,10 +81,13 @@ public class TestConfigSerializer {
public byte[] configJson(ApplicationId id,
JobType type,
boolean isCI,
+ Version platform,
+ RevisionId revision,
+ Instant deployedAt,
Map<ZoneId, List<Endpoint>> deployments,
Map<ZoneId, List<String>> clusters) {
try {
- return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, deployments, clusters));
+ return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, platform, revision, deployedAt, deployments, clusters));
}
catch (IOException e) {
throw new UncheckedIOException(e);
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 ef7c7063355..63f33540721 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
@@ -2345,16 +2345,24 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler {
.flatMap(instance -> instance.productionDeployments().keySet().stream())
.map(zone -> new DeploymentId(prodInstanceId, zone))
.collect(Collectors.toCollection(HashSet::new));
- ZoneId testedZone = type.zone();
+
// 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.
+ ApplicationId toTest = type.isProduction() ? prodInstanceId : id;
if ( ! type.isProduction())
- deployments.add(new DeploymentId(id, testedZone));
+ deployments.add(new DeploymentId(toTest, type.zone()));
+
+ Deployment deployment = application.require(toTest.instance()).deployments().get(type.zone());
+ if (deployment == null)
+ throw new NotExistsException(toTest + " is not deployed in " + type.zone());
return new SlimeJsonResponse(testConfigSerializer.configSlime(id,
type,
false,
+ deployment.version(),
+ deployment.revision(),
+ deployment.at(),
controller.routing().readTestRunnerEndpointsOf(deployments),
controller.applications().reachableContentClustersByZone(deployments)));
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
index 59ee8cc6eae..67583891765 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java
@@ -1,12 +1,14 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.deployment;
+import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.slime.SlimeUtils;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
+import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import com.yahoo.vespa.hosted.controller.application.EndpointId;
import org.junit.Test;
@@ -14,6 +16,7 @@ import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.time.Instant;
import java.util.List;
import java.util.Map;
@@ -31,6 +34,9 @@ public class TestConfigSerializerTest {
byte[] json = new TestConfigSerializer(SystemName.PublicCd).configJson(instanceId,
DeploymentContext.systemTest,
true,
+ Version.fromString("1.2.3"),
+ RevisionId.forProduction(321),
+ Instant.ofEpochMilli(222),
Map.of(zone, List.of(Endpoint.of(ApplicationId.defaultId())
.target(EndpointId.of("ai"), ClusterSpec.Id.from("qrs"),
List.of(new DeploymentId(ApplicationId.defaultId(),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json
index 3a5e6dc5dc3..ac0f2b9f740 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json
@@ -3,6 +3,9 @@
"zone": "dev.us-east-1",
"system": "main",
"isCI": false,
+ "platform": "6.1.0",
+ "revision": 1,
+ "deployedAt": 1600000000000,
"endpoints": {
"dev.us-east-1": [
"https://my-user.application1.tenant1.us-east-1.dev.vespa.oath.cloud/"
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json
index 0a9236655ba..671c34cb2c0 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json
@@ -3,6 +3,9 @@
"zone": "prod.us-central-1",
"system": "main",
"isCI": false,
+ "platform": "6.1.0",
+ "revision": 1,
+ "deployedAt": 1600000000000,
"endpoints": {
"prod.us-central-1": [
"https://application1.tenant1.us-central-1.vespa.oath.cloud/"
diff --git a/controller-server/src/test/resources/testConfig.json b/controller-server/src/test/resources/testConfig.json
index 5c3d5942001..0ea4b163992 100644
--- a/controller-server/src/test/resources/testConfig.json
+++ b/controller-server/src/test/resources/testConfig.json
@@ -3,6 +3,9 @@
"zone": "test.us-east-1",
"system": "publiccd",
"isCI": true,
+ "platform": "1.2.3",
+ "revision": 321,
+ "deployedAt": 222,
"endpoints": {
"test.us-east-1": [
"https://ai.default.default.global.vespa.oath.cloud/"