summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-10-08 14:50:28 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-10-08 14:50:28 +0200
commitbdbc7feedfb1ee4767a37e5166a884b71221ba45 (patch)
tree857aa730f482a420977426851af61ea662d781ee
parent1be5a1edc8d308a6be8c4b43a72ce395fec04359 (diff)
Indicate whether test runtime is CI or not, in TestConfig
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java1
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java1
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java1
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json1
-rw-r--r--controller-server/src/test/resources/testConfig.json1
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java19
-rw-r--r--hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java3
-rw-r--r--hosted-api/src/test/resources/test-config.json1
9 files changed, 26 insertions, 7 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 50af8bd8611..c07ae8f5571 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
@@ -465,6 +465,7 @@ public class InternalStepRunner implements StepRunner {
TesterCloud.Suite.of(id.type()),
testConfigSerializer.configJson(id.application(),
id.type(),
+ true,
endpoints,
controller.applications().contentClustersByZone(id.application(), zones)));
return Optional.of(running);
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 e79692d34ed..c33c4681dd9 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
@@ -30,6 +30,7 @@ public class TestConfigSerializer {
public Slime configSlime(ApplicationId id,
JobType type,
+ boolean isCI,
Map<ZoneId, Map<ClusterSpec.Id, URI>> deployments,
Map<ZoneId, List<String>> clusters) {
Slime slime = new Slime();
@@ -38,6 +39,7 @@ public class TestConfigSerializer {
root.setString("application", id.serializedForm());
root.setString("zone", type.zone(system).value());
root.setString("system", system.value());
+ root.setBool("isCI", isCI);
Cursor endpointsObject = root.setObject("endpoints"); // TODO jvenstad: remove.
deployments.forEach((zone, endpoints) -> {
@@ -69,10 +71,11 @@ public class TestConfigSerializer {
/** Returns the config for the tests to run for the given job. */
public byte[] configJson(ApplicationId id,
JobType type,
+ boolean isCI,
Map<ZoneId, Map<ClusterSpec.Id, URI>> deployments,
Map<ZoneId, List<String>> clusters) {
try {
- return SlimeUtils.toJsonBytes(configSlime(id, type, deployments, clusters));
+ return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, 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 e4ee858ab4c..b022fbcdd81 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
@@ -1523,6 +1523,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
Set<ZoneId> zones = controller.jobController().testedZoneAndProductionZones(id, type);
return new SlimeJsonResponse(testConfigSerializer.configSlime(id,
type,
+ false,
controller.applications().clusterEndpoints(id, zones),
controller.applications().contentClustersByZone(id, zones)));
}
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 2ddef642065..e28e5dab555 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
@@ -27,6 +27,7 @@ public class TestConfigSerializerTest {
ZoneId zone = JobType.systemTest.zone(SystemName.PublicCd);
byte[] json = new TestConfigSerializer(SystemName.PublicCd).configJson(instanceId,
JobType.systemTest,
+ true,
Map.of(zone, Map.of(ClusterSpec.Id.from("ai"),
URI.create("https://server/"))),
Map.of(zone, List.of("facts")));
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 2338543b019..b3fa30ee975 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
@@ -2,6 +2,7 @@
"application": "tenant1:application1:instance1",
"zone": "prod.us-central-1",
"system": "main",
+ "isCI": false,
"endpoints": {
"prod.us-central-1": [
"http://old-endpoint.vespa.yahooapis.com:4080"
diff --git a/controller-server/src/test/resources/testConfig.json b/controller-server/src/test/resources/testConfig.json
index 4145d863995..3b01f7f39ca 100644
--- a/controller-server/src/test/resources/testConfig.json
+++ b/controller-server/src/test/resources/testConfig.json
@@ -2,6 +2,7 @@
"application": "tenant:application:default",
"zone": "test.aws-us-east-1c",
"system": "publiccd",
+ "isCI": true,
"endpoints": {
"test.aws-us-east-1c": [
"https://server/"
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java b/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java
index c1104c649f2..768b7d9a50c 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java
@@ -28,16 +28,18 @@ public class TestConfig {
private final ApplicationId application;
private final ZoneId zone;
private final SystemName system;
+ private final boolean isCI;
private final Map<ZoneId, Map<String, URI>> deployments;
private final Map<ZoneId, List<String>> contentClusters;
- public TestConfig(ApplicationId application, ZoneId zone, SystemName system, Map<ZoneId, Map<String, URI>> deployments,
- Map<ZoneId, List<String>> contentClusters) {
+ public TestConfig(ApplicationId application, ZoneId zone, SystemName system, boolean isCI,
+ Map<ZoneId, Map<String, URI>> deployments, Map<ZoneId, List<String>> contentClusters) {
if ( ! deployments.containsKey(zone))
throw new IllegalArgumentException("Config must contain a deployment for its zone, but only does for " + deployments.keySet());
this.application = requireNonNull(application);
this.zone = requireNonNull(zone);
this.system = requireNonNull(system);
+ this.isCI = isCI;
this.deployments = deployments.entrySet().stream()
.collect(Collectors.toUnmodifiableMap(entry -> entry.getKey(),
entry -> Map.copyOf(entry.getValue())));
@@ -60,6 +62,7 @@ public class TestConfig {
ApplicationId application = ApplicationId.fromSerializedForm(config.field("application").asString());
ZoneId zone = ZoneId.from(config.field("zone").asString());
SystemName system = SystemName.from(config.field("system").asString());
+ boolean isCI = config.field("isCI").asBool();
Map<ZoneId, Map<String, URI>> deployments = new HashMap<>();
config.field("zoneEndpoints").traverse((ObjectTraverser) (zoneId, clustersObject) -> {
deployments.put(ZoneId.from(zoneId), toClusterMap(clustersObject));
@@ -70,7 +73,7 @@ public class TestConfig {
clustersArray.traverse((ArrayTraverser) (__, cluster) -> clusters.add(cluster.asString()));
contentClusters.put(ZoneId.from(zoneId), clusters);
}));
- return new TestConfig(application, zone, system, deployments, contentClusters);
+ return new TestConfig(application, zone, system, isCI, deployments, contentClusters);
}
static Map<String, URI> toClusterMap(Inspector clustersObject) {
@@ -87,6 +90,7 @@ public class TestConfig {
return new TestConfig(ApplicationId.defaultId(),
ZoneId.defaultId(),
SystemName.defaultSystem(),
+ false,
Map.of(ZoneId.defaultId(), endpoints),
Map.of());
}
@@ -97,13 +101,16 @@ public class TestConfig {
/** Returns the zone of the deployment to test. */
public ZoneId zone() { return zone; }
+ /** Returns the Vespa cloud system this is run against. */
+ public SystemName system() { return system; }
+
+ /** Returns whether this is a CI job (or a local developer environment). */
+ public boolean isCI() { return isCI; }
+
/** Returns an immutable view of deployments, per zone, of the application to test. */
public Map<ZoneId, Map<String, URI>> deployments() { return deployments; }
/** Returns an immutable view of content clusters, per zone, of the application to test. */
public Map<ZoneId, List<String>> contentClusters() { return contentClusters; }
- /** Returns the hosted Vespa system this is run against. */
- public SystemName system() { return system; }
-
}
diff --git a/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java b/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java
index 5ed008cc2ec..9ac02cd9130 100644
--- a/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java
+++ b/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java
@@ -13,6 +13,8 @@ import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author jonmv
@@ -28,6 +30,7 @@ public class TestConfigTest {
config.zone());
assertEquals(SystemName.PublicCd,
config.system());
+ assertTrue(config.isCI());
assertEquals(Map.of(ZoneId.from("dev", "aws-us-east-1c"),
Map.of("default", URI.create("https://dev.endpoint:443/")),
ZoneId.from("prod", "aws-us-east-1a"),
diff --git a/hosted-api/src/test/resources/test-config.json b/hosted-api/src/test/resources/test-config.json
index bd337e1c28a..07454efdb66 100644
--- a/hosted-api/src/test/resources/test-config.json
+++ b/hosted-api/src/test/resources/test-config.json
@@ -2,6 +2,7 @@
"application": "t:a:i",
"zone": "dev.aws-us-east-1c",
"system": "publiccd",
+ "isCI": true,
"zoneEndpoints": {
"dev.aws-us-east-1c": {
"default": "https://dev.endpoint:443/"