aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-03-01 11:58:09 +0100
committerJon Bratseth <bratseth@gmail.com>2023-03-01 11:58:09 +0100
commitaac4ee4d7fa305cdbda4ab82db7f9dc45aa9f090 (patch)
tree72f1f8437a53ad7330d6d61e05f5e17b3352044e /config-model
parent42f5944056ed2b9d46b1b5538cbcccf0b369ca44 (diff)
Pass ClusterInfo
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java15
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java3
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java2
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java15
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java11
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java49
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java29
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java85
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CloudAccountChangeValidatorTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java2
12 files changed, 173 insertions, 50 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java b/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java
index d9918168266..13d87b852e4 100644
--- a/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java
+++ b/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java
@@ -7,8 +7,11 @@ import com.yahoo.config.model.api.ModelContext;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AnyConfigProducer;
import com.yahoo.config.model.producer.TreeConfigProducer;
+import com.yahoo.config.provision.ClusterInfo;
import com.yahoo.vespa.model.VespaModel;
+import java.time.Duration;
+import java.util.Comparator;
import java.util.stream.Stream;
/**
@@ -67,6 +70,18 @@ public final class ConfigModelContext {
return ConfigModelContext.create(deployState, vespaModel, configModelRepoAdder, parent, producerId);
}
+ /** Returns a cluster info builder pre-populated with info known in this context. */
+ public ClusterInfo.Builder clusterInfo() {
+ var instance = getApplicationPackage().getDeploymentSpec().instance(properties().applicationId().instance());
+ if ( ! instance.isPresent()) return new ClusterInfo.Builder();
+ var maxDeadline = instance.get().bcp().groups().stream()
+ .filter(group -> group.memberRegions().contains(properties().zone().region()))
+ .map(group -> group.deadline())
+ .min(Comparator.comparing(deadline -> deadline))
+ .orElse(Duration.ofMinutes(0));
+ return new ClusterInfo.Builder().bcpDeadline(maxDeadline);
+ }
+
/**
* Create an application context from a parent producer and an id.
*
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index 1813e183a60..b8d63ba3778 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -24,6 +24,7 @@ import com.yahoo.config.model.api.ValidationParameters;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.config.model.application.provider.MockFileRegistry;
import com.yahoo.config.model.provision.HostsXmlProvisioner;
+import com.yahoo.config.model.provision.InMemoryProvisioner;
import com.yahoo.config.model.provision.SingleNodeProvisioner;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.provision.DockerImage;
@@ -77,7 +78,7 @@ public class DeployState implements ConfigDefinitionStore {
private final ModelContext.Properties properties;
private final Version vespaVersion;
private final Set<ContainerEndpoint> endpoints;
- private final Zone zone;
+ private final Zone zone; // TODO: Zone is set separately both here and in properties
private final QueryProfiles queryProfiles;
private final SemanticRules semanticRules;
private final ImportedMlModels importedModels;
diff --git a/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java b/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java
index dd6087eefc7..41697e61bf2 100644
--- a/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java
+++ b/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java
@@ -129,6 +129,8 @@ public class InMemoryProvisioner implements HostProvisioner {
this.retiredHostNames = Set.of(retiredHostNames);
}
+ public Provisioned provisioned() { return provisioned; }
+
/** May affect e.g. the number of nodes/cluster. */
public InMemoryProvisioner setEnvironment(Environment environment) {
this.environment = environment;
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
index b5999c15fad..3b715c63105 100644
--- a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
+++ b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
@@ -6,6 +6,7 @@ import com.yahoo.config.application.api.ApplicationFile;
import com.yahoo.config.application.api.ApplicationMetaData;
import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.application.api.ComponentInfo;
+import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.application.api.UnparsedConfigDefinition;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
@@ -57,12 +58,14 @@ public class MockApplicationPackage implements ApplicationPackage {
private final List<String> schemas;
private final Map<Path, MockApplicationFile> files;
private final String schemaDir;
- private final Optional<String> deploymentSpec;
+ private final Optional<String> deploymentSpecString;
private final Optional<String> validationOverrides;
private final boolean failOnValidateXml;
private final QueryProfileRegistry queryProfileRegistry;
private final ApplicationMetaData applicationMetaData;
+ private DeploymentSpec deploymentSpec = null;
+
protected MockApplicationPackage(File root, String hosts, String services, List<String> schemas,
Map<Path, MockApplicationFile> files,
String schemaDir,
@@ -74,7 +77,7 @@ public class MockApplicationPackage implements ApplicationPackage {
this.schemas = schemas;
this.files = files;
this.schemaDir = schemaDir;
- this.deploymentSpec = Optional.ofNullable(deploymentSpec);
+ this.deploymentSpecString = Optional.ofNullable(deploymentSpec);
this.validationOverrides = Optional.ofNullable(validationOverrides);
this.failOnValidateXml = failOnValidateXml;
queryProfileRegistry = new QueryProfileXMLReader().read(asNamedReaderList(queryProfileType),
@@ -102,6 +105,12 @@ public class MockApplicationPackage implements ApplicationPackage {
}
@Override
+ public DeploymentSpec getDeploymentSpec() {
+ if (deploymentSpec != null) return deploymentSpec;
+ return deploymentSpec = parseDeploymentSpec(false);
+ }
+
+ @Override
public Reader getHosts() {
if (hostsS == null) return null;
return new StringReader(hostsS);
@@ -183,7 +192,7 @@ public class MockApplicationPackage implements ApplicationPackage {
@Override
public Optional<Reader> getDeployment() {
- return deploymentSpec.map(StringReader::new);
+ return deploymentSpecString.map(StringReader::new);
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
index 567ccbfa88b..80000e54b1b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java
@@ -123,7 +123,8 @@ public class DomAdminV4Builder extends DomAdminBuilderBase {
ClusterSpec.Type.admin,
ClusterSpec.Id.from(clusterId),
context.getDeployLogger(),
- false)
+ false,
+ context.clusterInfo().build())
.keySet();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
index b5fa451fa0b..c968e31325a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.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.model.builder.xml.dom;
+import com.yahoo.config.provision.ClusterInfo;
import com.yahoo.config.provision.IntRange;
import com.yahoo.collections.Pair;
import com.yahoo.component.Version;
@@ -266,8 +267,9 @@ public class NodesSpecification {
ClusterSpec.Type clusterType,
ClusterSpec.Id clusterId,
DeployLogger logger,
- boolean stateful) {
- return provision(hostSystem, clusterType, clusterId, ZoneEndpoint.defaultEndpoint, logger, stateful);
+ boolean stateful,
+ ClusterInfo clusterInfo) {
+ return provision(hostSystem, clusterType, clusterId, ZoneEndpoint.defaultEndpoint, logger, stateful, clusterInfo);
}
public Map<HostResource, ClusterMembership> provision(HostSystem hostSystem,
@@ -275,7 +277,8 @@ public class NodesSpecification {
ClusterSpec.Id clusterId,
ZoneEndpoint zoneEndpoint,
DeployLogger logger,
- boolean stateful) {
+ boolean stateful,
+ ClusterInfo info) {
if (combinedId.isPresent())
clusterType = ClusterSpec.Type.combined;
ClusterSpec cluster = ClusterSpec.request(clusterType, clusterId)
@@ -286,7 +289,7 @@ public class NodesSpecification {
.loadBalancerSettings(zoneEndpoint)
.stateful(stateful)
.build();
- return hostSystem.allocateHosts(cluster, Capacity.from(min, max, groupSize, required, canFail, cloudAccount), logger);
+ return hostSystem.allocateHosts(cluster, Capacity.from(min, max, groupSize, required, canFail, cloudAccount, info), logger);
}
private static Pair<NodeResources, NodeResources> nodeResources(ModelElement nodesElement) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
index a639c158d62..36d34b99223 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.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.model.container.xml;
+import com.yahoo.config.provision.ClusterInfo;
import com.yahoo.config.provision.IntRange;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.component.Version;
@@ -345,10 +346,10 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
private void addDeploymentSpecConfig(ApplicationContainerCluster cluster, ConfigModelContext context, DeployLogger deployLogger) {
if ( ! context.getDeployState().isHosted()) return;
- Optional<DeploymentSpec> deploymentSpec = app.getDeployment().map(DeploymentSpec::fromXml);
+ DeploymentSpec deploymentSpec = app.getDeploymentSpec();
if (deploymentSpec.isEmpty()) return;
- for (var deprecatedElement : deploymentSpec.get().deprecatedElements()) {
+ for (var deprecatedElement : deploymentSpec.deprecatedElements()) {
deployLogger.logApplicationPackage(WARNING, deprecatedElement.humanReadableString());
}
@@ -358,8 +359,8 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
context.getDeployState().getProperties().ztsUrl(),
context.getDeployState().getProperties().athenzDnsSuffix(),
context.getDeployState().zone(),
- deploymentSpec.get());
- addRotationProperties(cluster, context.getDeployState().zone(), context.getDeployState().getEndpoints(), deploymentSpec.get());
+ deploymentSpec);
+ addRotationProperties(cluster, context.getDeployState().zone(), context.getDeployState().getEndpoints(), deploymentSpec);
}
private void addRotationProperties(ApplicationContainerCluster cluster, Zone zone, Set<ContainerEndpoint> endpoints, DeploymentSpec spec) {
@@ -863,10 +864,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
InstanceName instance = context.properties().applicationId().instance();
ZoneId zone = ZoneId.from(context.properties().zone().environment(),
context.properties().zone().region());
- DeploymentSpec spec = context.getApplicationPackage().getDeployment()
- .map(new DeploymentSpecXmlReader(false)::read)
- .orElse(DeploymentSpec.empty);
- return spec.zoneEndpoint(instance, zone, cluster);
+ return context.getApplicationPackage().getDeploymentSpec().zoneEndpoint(instance, zone, cluster);
}
private static Map<String, String> getEnvironmentVariables(Element environmentVariables) {
@@ -924,22 +922,15 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
HostSystem hostSystem = cluster.hostSystem();
if (deployState.isHosted()) {
// request just enough nodes to satisfy environment capacity requirement
- ClusterSpec clusterSpec = ClusterSpec.request(ClusterSpec.Type.container,
- ClusterSpec.Id.from(cluster.getName()))
- .vespaVersion(deployState.getWantedNodeVespaVersion())
- .dockerImageRepository(deployState.getWantedDockerImageRepo())
- .build();
int nodeCount = deployState.zone().environment().isProduction() ? 2 : 1;
- deployState.getDeployLogger().logApplicationPackage(Level.INFO, "Using " + nodeCount +
- " nodes in " + cluster);
- ClusterResources resources = new ClusterResources(nodeCount, 1, NodeResources.unspecified());
- Capacity capacity = Capacity.from(resources,
- resources,
- IntRange.empty(),
- false,
- !deployState.getProperties().isBootstrap(),
- context.getDeployState().getProperties().cloudAccount());
- var hosts = hostSystem.allocateHosts(clusterSpec, capacity, log);
+ deployState.getDeployLogger().logApplicationPackage(Level.INFO, "Using " + nodeCount + " nodes in " + cluster);
+ var nodesSpec = NodesSpecification.dedicated(nodeCount, context);
+ var hosts = nodesSpec.provision(hostSystem,
+ ClusterSpec.Type.container,
+ ClusterSpec.Id.from(cluster.getName()),
+ deployState.getDeployLogger(),
+ false,
+ context.clusterInfo().build());
return createNodesFromHosts(hosts, cluster, context.getDeployState());
}
else {
@@ -956,15 +947,15 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
private List<ApplicationContainer> createNodesFromNodeCount(ApplicationContainerCluster cluster, Element containerElement, Element nodesElement, ConfigModelContext context) {
try {
- NodesSpecification nodesSpecification = NodesSpecification.from(new ModelElement(nodesElement), context);
- ClusterSpec.Id clusterId = ClusterSpec.Id.from(cluster.name());
- ZoneEndpoint zoneEndpoint = zoneEndpoint(context, clusterId);
+ var nodesSpecification = NodesSpecification.from(new ModelElement(nodesElement), context);
+ var clusterId = ClusterSpec.Id.from(cluster.name());
Map<HostResource, ClusterMembership> hosts = nodesSpecification.provision(cluster.getRoot().hostSystem(),
ClusterSpec.Type.container,
clusterId,
- zoneEndpoint,
+ zoneEndpoint(context, clusterId),
log,
- getZooKeeper(containerElement) != null);
+ getZooKeeper(containerElement) != null,
+ context.clusterInfo().build());
return createNodesFromHosts(hosts, cluster, context.getDeployState());
}
catch (IllegalArgumentException e) {
@@ -998,7 +989,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> {
StorageGroup.provisionHosts(nodeSpecification,
referenceId,
cluster.getRoot().hostSystem(),
- context.getDeployLogger());
+ context);
return createNodesFromHosts(hosts, cluster, context.getDeployState());
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
index 31ec764fbde..52b2ce06dfe 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageGroup.java
@@ -187,10 +187,15 @@ public class StorageGroup {
public static Map<HostResource, ClusterMembership> provisionHosts(NodesSpecification nodesSpecification,
String clusterIdString,
- HostSystem hostSystem,
- DeployLogger logger) {
+ HostSystem hostSystem,
+ ConfigModelContext context) {
ClusterSpec.Id clusterId = ClusterSpec.Id.from(clusterIdString);
- return nodesSpecification.provision(hostSystem, ClusterSpec.Type.content, clusterId, logger, true);
+ return nodesSpecification.provision(hostSystem,
+ ClusterSpec.Type.content,
+ clusterId,
+ context.getDeployLogger(),
+ true,
+ context.clusterInfo().build());
}
public static class Builder {
@@ -203,7 +208,9 @@ public class StorageGroup {
this.context = context;
}
- public StorageGroup buildRootGroup(DeployState deployState, RedundancyBuilder redundancyBuilder, ContentCluster owner) {
+ public StorageGroup buildRootGroup(DeployState deployState,
+ RedundancyBuilder redundancyBuilder,
+ ContentCluster owner) {
try {
if (owner.isHosted())
validateRedundancyAndGroups(deployState.zone().environment());
@@ -219,7 +226,7 @@ public class StorageGroup {
GroupBuilder groupBuilder = collectGroup(owner.isHosted(), group, nodes, null, null);
StorageGroup storageGroup = owner.isHosted()
- ? groupBuilder.buildHosted(deployState, owner, Optional.empty())
+ ? groupBuilder.buildHosted(deployState, owner, Optional.empty(), context)
: groupBuilder.buildNonHosted(deployState, owner, Optional.empty());
Redundancy redundancy = redundancyBuilder.build(owner.isHosted(), storageGroup.subgroups.size(),
@@ -334,12 +341,18 @@ public class StorageGroup {
* @param parent the parent storage group, or empty if this is the root group
* @return the storage group build by this
*/
- public StorageGroup buildHosted(DeployState deployState, ContentCluster owner, Optional<GroupBuilder> parent) {
+ public StorageGroup buildHosted(DeployState deployState,
+ ContentCluster owner,
+ Optional<GroupBuilder> parent,
+ ConfigModelContext context) {
if (storageGroup.getIndex() != null)
throw new IllegalArgumentException("Specifying individual groups is not supported on hosted applications");
Map<HostResource, ClusterMembership> hostMapping =
nodeRequirement.isPresent() ?
- provisionHosts(nodeRequirement.get(), owner.getStorageCluster().getClusterName(), owner.getRoot().hostSystem(), deployState.getDeployLogger()) :
+ provisionHosts(nodeRequirement.get(),
+ owner.getStorageCluster().getClusterName(),
+ owner.getRoot().hostSystem(),
+ context) :
Collections.emptyMap();
Map<Optional<ClusterSpec.Group>, Map<HostResource, ClusterMembership>> hostGroups = collectAllocatedSubgroups(hostMapping);
@@ -362,7 +375,7 @@ public class StorageGroup {
storageGroup.nodes.add(createStorageNode(deployState, owner, host.getKey(), storageGroup, host.getValue()));
}
for (GroupBuilder subGroup : subGroups) {
- storageGroup.subgroups.add(subGroup.buildHosted(deployState, owner, Optional.of(this)));
+ storageGroup.subgroups.add(subGroup.buildHosted(deployState, owner, Optional.of(this), context));
}
}
return storageGroup;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
index 137e19e7d86..7f4fc4cd89d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
@@ -150,7 +150,7 @@ public class ContentCluster extends TreeConfigProducer<AnyConfigProducer> implem
if (e != null)
setupDocumentProcessing(c, e);
} else if (c.persistenceFactory != null) {
- throw new IllegalArgumentException("The specified content engine requires the <documents> element to be specified.");
+ throw new IllegalArgumentException("The <documents> element is mandatory in content cluster '" + clusterId + "'");
}
ModelElement tuning = contentElement.child("tuning");
@@ -333,7 +333,8 @@ public class ContentCluster extends TreeConfigProducer<AnyConfigProducer> implem
ClusterSpec.Type.admin,
ClusterSpec.Id.from(clusterName),
context.getDeployLogger(),
- true)
+ true,
+ context.clusterInfo().build())
.keySet();
admin.setClusterControllers(createClusterControllers(new ClusterControllerCluster(admin, "standalone", deployState),
hosts,
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java b/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java
new file mode 100644
index 00000000000..0abb153696c
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java
@@ -0,0 +1,85 @@
+package com.yahoo.vespa.model;
+
+import com.yahoo.config.model.NullConfigModelRegistry;
+import com.yahoo.config.model.deploy.DeployState;
+import com.yahoo.config.model.deploy.TestProperties;
+import com.yahoo.config.model.provision.InMemoryProvisioner;
+import com.yahoo.config.model.test.MockApplicationPackage;
+import com.yahoo.config.provision.Capacity;
+import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.Environment;
+import com.yahoo.config.provision.RegionName;
+import com.yahoo.config.provision.Zone;
+import org.junit.jupiter.api.Test;
+
+import java.time.Duration;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * @author bratseth
+ */
+public class ClusterInfoTest {
+
+ @Test
+ void bcp_deadline_is_passed_in_cluster_info() throws Exception {
+ var servicesXml = """
+ <services version='1.0'>
+ <container id='testcontainer' version='1.0'>
+ <nodes count='3'/>
+ </container>
+ <content id='testcontent' version='1.0'>
+ <redundancy>2</redundancy>
+ <documents/>
+ </content>
+ </services>
+ """;
+
+ var deploymentXml = """
+ <deployment version='1.0'>
+ <prod>
+ <region>us-west-1</region>
+ <region>us-east-1</region>
+ </prod>
+ <bcp>
+ <group deadline='30m'>
+ <region fraction='0.5'>us-east-1</region>
+ <region>us-west-1</region>
+ </group>
+ <group>
+ <region fraction='0.5'>us-east-1</region>
+ </group>
+ </bcp>
+ </deployment>
+ """;
+
+ var requestedInUsEast1 = requestedCapacityIn("us-east-1", servicesXml, deploymentXml);
+ assertEquals(Duration.ofMinutes(0), requestedInUsEast1.get(new ClusterSpec.Id("testcontainer")).clusterInfo().bcpDeadline());
+ assertEquals(Duration.ofMinutes(0), requestedInUsEast1.get(new ClusterSpec.Id("testcontent")).clusterInfo().bcpDeadline());
+
+ var requestedInUsWest1 = requestedCapacityIn("us-west-1", servicesXml, deploymentXml);
+ assertEquals(Duration.ofMinutes(30), requestedInUsWest1.get(new ClusterSpec.Id("testcontainer")).clusterInfo().bcpDeadline());
+ assertEquals(Duration.ofMinutes(30), requestedInUsWest1.get(new ClusterSpec.Id("testcontent")).clusterInfo().bcpDeadline());
+ }
+
+ private Map<ClusterSpec.Id, Capacity> requestedCapacityIn(String region, String servicesXml, String deploymentXml) throws Exception {
+ var applicationPackage = new MockApplicationPackage.Builder()
+ .withServices(servicesXml)
+ .withDeploymentSpec(deploymentXml)
+ .build();
+
+ var provisioner = new InMemoryProvisioner(10, true);
+ var deployState = new DeployState.Builder()
+ .applicationPackage(applicationPackage)
+ .zone(new Zone(Environment.prod, RegionName.from(region)))
+ .properties(new TestProperties().setHostedVespa(true)
+ .setZone(new Zone(Environment.prod, RegionName.from(region))))
+ .modelHostProvisioner(provisioner)
+ .provisioned(provisioner.provisioned())
+ .build();
+ new VespaModel(new NullConfigModelRegistry(), deployState);
+ return deployState.provisioned().all();
+ }
+
+}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CloudAccountChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CloudAccountChangeValidatorTest.java
index fcc8c82a6e9..a8a063cb5fb 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CloudAccountChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CloudAccountChangeValidatorTest.java
@@ -1,5 +1,6 @@
package com.yahoo.vespa.model.application.validation.change;
+import com.yahoo.config.provision.ClusterInfo;
import com.yahoo.config.provision.IntRange;
import com.yahoo.config.model.api.Provisioned;
import com.yahoo.config.model.deploy.DeployState;
@@ -57,7 +58,8 @@ class CloudAccountChangeValidatorTest {
IntRange.empty(),
false,
false,
- Optional.of(cloudAccount).filter(account -> !account.isUnspecified()));
+ Optional.of(cloudAccount).filter(account -> !account.isUnspecified()),
+ ClusterInfo.empty());
}
private static VespaModel model(Provisioned provisioned) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
index 6ac4dbd17e3..cad36f5574c 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
@@ -835,7 +835,7 @@ public class ContentBuilderTest extends DomBuilderTest {
" </group>" +
"</content>");
});
- assertTrue(exception.getMessage().contains("The specified content engine requires the <documents> element to be specified."));
+ assertEquals("The <documents> element is mandatory in content cluster 'a'", exception.getMessage());
}
private ProtonConfig getProtonConfig(ContentCluster content) {