summaryrefslogtreecommitdiffstats
path: root/hosted-api/src/main/java/ai
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 /hosted-api/src/main/java/ai
parent1be5a1edc8d308a6be8c4b43a72ce395fec04359 (diff)
Indicate whether test runtime is CI or not, in TestConfig
Diffstat (limited to 'hosted-api/src/main/java/ai')
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java19
1 files changed, 13 insertions, 6 deletions
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; }
-
}