summaryrefslogtreecommitdiffstats
path: root/config-model/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test')
-rw-r--r--config-model/src/test/derived/namecollision/collision.sd8
-rw-r--r--config-model/src/test/derived/namecollision/collisionstruct.sd15
-rw-r--r--config-model/src/test/derived/namecollision/documentmanager.cfg55
-rw-r--r--config-model/src/test/derived/rankexpression/rankexpression.sd4
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/MockModelContext.java5
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/NameCollisionTestCase.java20
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/VespaModelFactoryTest.java1
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerClusterTest.java49
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyModelTester.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java64
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/first/RedundancyOnFirstDeploymentValidatorTest.java64
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java58
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java1
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java154
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java338
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java7
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java6
29 files changed, 538 insertions, 379 deletions
diff --git a/config-model/src/test/derived/namecollision/collision.sd b/config-model/src/test/derived/namecollision/collision.sd
new file mode 100644
index 00000000000..43dd4830204
--- /dev/null
+++ b/config-model/src/test/derived/namecollision/collision.sd
@@ -0,0 +1,8 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search collision {
+
+ document collision {
+
+ }
+
+}
diff --git a/config-model/src/test/derived/namecollision/collisionstruct.sd b/config-model/src/test/derived/namecollision/collisionstruct.sd
new file mode 100644
index 00000000000..c98efb0b582
--- /dev/null
+++ b/config-model/src/test/derived/namecollision/collisionstruct.sd
@@ -0,0 +1,15 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search collisionstruct {
+
+ document collisionstruct {
+
+ struct collision {
+ }
+
+ field structarray type array<collision> {
+ indexing: summary
+ }
+
+ }
+
+}
diff --git a/config-model/src/test/derived/namecollision/documentmanager.cfg b/config-model/src/test/derived/namecollision/documentmanager.cfg
new file mode 100644
index 00000000000..8d0d89dde35
--- /dev/null
+++ b/config-model/src/test/derived/namecollision/documentmanager.cfg
@@ -0,0 +1,55 @@
+enablecompression false
+datatype[].id 1381038251
+datatype[].structtype[].name "position"
+datatype[].structtype[].version 0
+datatype[].structtype[].compresstype NONE
+datatype[].structtype[].compresslevel 0
+datatype[].structtype[].compressthreshold 95
+datatype[].structtype[].compressminsize 800
+datatype[].structtype[].field[].name "x"
+datatype[].structtype[].field[].datatype 0
+datatype[].structtype[].field[].detailedtype ""
+datatype[].structtype[].field[].name "y"
+datatype[].structtype[].field[].datatype 0
+datatype[].structtype[].field[].detailedtype ""
+datatype[].id -379118517
+datatype[].structtype[].name "collision.header"
+datatype[].structtype[].version 0
+datatype[].structtype[].compresstype NONE
+datatype[].structtype[].compresslevel 0
+datatype[].structtype[].compressthreshold 95
+datatype[].structtype[].compressminsize 800
+datatype[].id 1557022836
+datatype[].documenttype[].name "collision"
+datatype[].documenttype[].version 0
+datatype[].documenttype[].inherits[].name "document"
+datatype[].documenttype[].inherits[].version 0
+datatype[].documenttype[].headerstruct -379118517
+datatype[].documenttype[].bodystruct 0
+datatype[].id 1557022836
+datatype[].structtype[].name "collision"
+datatype[].structtype[].version 0
+datatype[].structtype[].compresstype NONE
+datatype[].structtype[].compresslevel 0
+datatype[].structtype[].compressthreshold 95
+datatype[].structtype[].compressminsize 800
+datatype[].id -1730522993
+datatype[].arraytype[].datatype 1557022836
+datatype[].id -1270379114
+datatype[].structtype[].name "collisionstruct.header"
+datatype[].structtype[].version 0
+datatype[].structtype[].compresstype NONE
+datatype[].structtype[].compresslevel 0
+datatype[].structtype[].compressthreshold 95
+datatype[].structtype[].compressminsize 800
+datatype[].structtype[].field[].name "structarray"
+datatype[].structtype[].field[].datatype -1730522993
+datatype[].structtype[].field[].detailedtype ""
+datatype[].id -1723079287
+datatype[].documenttype[].name "collisionstruct"
+datatype[].documenttype[].version 0
+datatype[].documenttype[].inherits[].name "document"
+datatype[].documenttype[].inherits[].version 0
+datatype[].documenttype[].headerstruct -1270379114
+datatype[].documenttype[].bodystruct 0
+datatype[].documenttype[].fieldsets{[]}.fields[] "structarray"
diff --git a/config-model/src/test/derived/rankexpression/rankexpression.sd b/config-model/src/test/derived/rankexpression/rankexpression.sd
index 20f9c7a9160..e615a1a7671 100644
--- a/config-model/src/test/derived/rankexpression/rankexpression.sd
+++ b/config-model/src/test/derived/rankexpression/rankexpression.sd
@@ -115,8 +115,8 @@ search rankexpression {
expression {
exp(0) +
mysum(attribute(foo),
- "attribute( bar )",
- "attribute( \"baz\" )")
+ "attribute( bar )",
+ "attribute( \"baz\" )")
}
rerank-count: 101
}
diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
index e7622816603..8f751631fb5 100644
--- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
@@ -54,7 +54,7 @@ public class ApplicationDeployTest {
@Test
public void testVespaModel() throws SAXException, IOException {
ApplicationPackageTester tester = ApplicationPackageTester.create(TESTDIR + "app1");
- VespaModel model = new VespaModel(tester.app());
+ new VespaModel(tester.app());
List<NamedSchema> schemas = tester.getSchemas();
assertEquals(schemas.size(), 5);
for (NamedSchema searchDefinition : schemas) {
diff --git a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
index f8469aa6fa1..59af3193b79 100644
--- a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
+++ b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java
@@ -20,8 +20,8 @@ import com.yahoo.config.model.test.MockApplicationPackage;
import java.util.Optional;
/**
-* @author hmusum
-*/
+ * @author hmusum
+ */
public class MockModelContext implements ModelContext {
private final ApplicationPackage applicationPackage;
@@ -82,4 +82,5 @@ public class MockModelContext implements ModelContext {
public Properties properties() {
return new TestProperties();
}
+
}
diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
index b1b386924d1..b0ddadf11bd 100644
--- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
@@ -49,6 +49,7 @@ import static com.yahoo.config.model.test.TestUtil.joinLines;
import static com.yahoo.vespa.defaults.Defaults.getDefaults;
import static com.yahoo.vespa.model.search.NodeResourcesTuning.GB;
import static com.yahoo.vespa.model.search.NodeResourcesTuning.reservedMemoryGb;
+import static com.yahoo.vespa.model.test.utils.ApplicationPackageUtils.generateSchemas;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -2015,7 +2016,7 @@ public class ModelProvisioningTest {
}
private VespaModel createNonProvisionedModel(boolean multitenant, String hosts, String services) {
- VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(hosts, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
+ VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(hosts, services, generateSchemas("type1"));
ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).
properties((new TestProperties()).setMultitenant(multitenant)).
@@ -2023,7 +2024,7 @@ public class ModelProvisioningTest {
return modelCreatorWithMockPkg.create(false, deployState);
}
- private int physicalMemoryPercentage(ContainerCluster cluster) {
+ private int physicalMemoryPercentage(ContainerCluster<?> cluster) {
QrStartConfig.Builder b = new QrStartConfig.Builder();
cluster.getConfig(b);
return b.build().jvm().heapSizeAsPercentageOfPhysicalMemory();
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
index 91e8640308a..d5ef3779493 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
@@ -102,7 +102,8 @@ public class RankProfileTestCase extends SchemaTestCase {
assertEquals(8, rankProfile.getNumThreadsPerSearch());
assertEquals(70, rankProfile.getMinHitsPerThread());
assertEquals(1200, rankProfile.getNumSearchPartitions());
- RawRankProfile rawRankProfile = new RawRankProfile(rankProfile, new QueryProfileRegistry(), new ImportedMlModels(), attributeFields, deployProperties);
+ RawRankProfile rawRankProfile = new RawRankProfile(rankProfile, new LargeRankExpressions(), new QueryProfileRegistry(),
+ new ImportedMlModels(), attributeFields, deployProperties);
if (expectedTermwiseLimit != null) {
assertTrue(findProperty(rawRankProfile.configProperties(), "vespa.matching.termwise_limit").isPresent());
assertEquals(String.valueOf(expectedTermwiseLimit), findProperty(rawRankProfile.configProperties(), "vespa.matching.termwise_limit").get());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/NameCollisionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/NameCollisionTestCase.java
new file mode 100644
index 00000000000..fda9e6327ce
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/NameCollisionTestCase.java
@@ -0,0 +1,20 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+package com.yahoo.searchdefinition.derived;
+
+import org.junit.Test;
+
+/**
+ * Verifies that a struct in a document type is preferred over another dopcument type
+ * of the same name.
+ *
+ * @author bratseth
+ */
+public class NameCollisionTestCase extends AbstractExportingTestCase {
+
+ @Test
+ public void testNameCollision() throws Exception {
+ assertCorrectDeriving("namecollision", "collisionstruct", new TestableDeployLogger());
+ }
+
+}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
index 2d8630e3ff7..e285d796882 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java
@@ -91,7 +91,7 @@ public class RankingExpressionWithTransformerTokensTestCase {
searchBuilder.build();
Search search = searchBuilder.getSearch();
RankProfile rp = rankProfileRegistry.get(search, "my_profile");
- return new RankProfileTransformContext(rp, queryProfileRegistry, Collections.EMPTY_MAP, null, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
+ return new RankProfileTransformContext(rp, queryProfileRegistry, Collections.emptyMap(), null, Collections.emptyMap(), Collections.emptyMap());
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java
index 85ef70132b5..021d2931414 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java
@@ -7,6 +7,7 @@ import com.yahoo.config.model.api.ModelContext;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.search.query.profile.QueryProfileRegistry;
+import com.yahoo.searchdefinition.LargeRankExpressions;
import com.yahoo.searchdefinition.RankProfile;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.SchemaTestCase;
@@ -49,7 +50,7 @@ public class RankingExpressionsTestCase extends SchemaTestCase {
functions.get("artistmatch").function().getBody().getRoot().toString());
assertEquals(0, functions.get("artistmatch").function().arguments().size());
- RawRankProfile rawRankProfile = new RawRankProfile(functionsRankProfile, new QueryProfileRegistry(),
+ RawRankProfile rawRankProfile = new RawRankProfile(functionsRankProfile, new LargeRankExpressions(), new QueryProfileRegistry(),
new ImportedMlModels(), new AttributeFields(search), deployProperties);
List<Pair<String, String>> rankProperties = rawRankProfile.configProperties();
assertEquals(6, rankProperties.size());
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/VespaModelFactoryTest.java b/config-model/src/test/java/com/yahoo/vespa/model/VespaModelFactoryTest.java
index e3e0edd7896..a3e3a768b05 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/VespaModelFactoryTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/VespaModelFactoryTest.java
@@ -19,7 +19,6 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.HostSpec;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.ProvisionLogger;
-import com.yahoo.vespa.model.builder.xml.dom.NodesSpecification;
import org.junit.Before;
import org.junit.Test;
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerClusterTest.java
index 1a7258db7e2..413daefdf75 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerClusterTest.java
@@ -1,8 +1,4 @@
-// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/*
- * Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
- */
-
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin.metricsproxy;
import ai.vespa.metricsproxy.http.application.ApplicationMetricsHandler;
@@ -13,14 +9,10 @@ import ai.vespa.metricsproxy.http.yamas.YamasHandler;
import ai.vespa.metricsproxy.metric.dimensions.ApplicationDimensionsConfig;
import ai.vespa.metricsproxy.metric.dimensions.PublicDimensions;
import com.yahoo.component.ComponentSpecification;
-import com.yahoo.config.model.api.HostInfo;
-import com.yahoo.config.model.deploy.DeployState;
-import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.provision.Zone;
import com.yahoo.container.core.ApplicationMetadataConfig;
import com.yahoo.container.di.config.PlatformBundlesConfig;
-import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyContainerCluster.AppDimensionNames;
import com.yahoo.vespa.model.container.component.Component;
@@ -40,14 +32,11 @@ import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.T
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.getApplicationDimensionsConfig;
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.getMetricsNodesConfig;
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.getModel;
-import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.getQrStartConfig;
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.servicesWithAdminOnly;
-import static com.yahoo.vespa.model.container.ContainerCluster.G1GC;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@@ -77,42 +66,6 @@ public class MetricsProxyContainerClusterTest {
assertEquals(MockApplicationPackage.DEPLOYED_BY_USER, config.user());
}
- private void metrics_proxy_has_expected_qr_start_options(MetricsProxyModelTester.TestMode mode) {
- metrics_proxy_has_expected_qr_start_options(mode, 0);
- }
-
- private void metrics_proxy_has_expected_qr_start_options(MetricsProxyModelTester.TestMode mode, int maxHeapForAdminClusterNodes) {
- DeployState.Builder builder = new DeployState.Builder();
- if (maxHeapForAdminClusterNodes > 0) {
- builder.properties(new TestProperties().metricsProxyMaxHeapSizeInMb(maxHeapForAdminClusterNodes));
- }
-
- VespaModel model = getModel(servicesWithAdminOnly(), mode, builder);
- for (HostInfo host : model.getHosts()) {
- QrStartConfig qrStartConfig = getQrStartConfig(model, host.getHostname());
- assertEquals(32, qrStartConfig.jvm().minHeapsize());
- assertEquals(maxHeapForAdminClusterNodes > 0 ? maxHeapForAdminClusterNodes : 512, qrStartConfig.jvm().heapsize());
- assertEquals(0, qrStartConfig.jvm().heapSizeAsPercentageOfPhysicalMemory());
- assertEquals(2, qrStartConfig.jvm().availableProcessors());
- assertFalse(qrStartConfig.jvm().verbosegc());
- assertEquals(G1GC, qrStartConfig.jvm().gcopts());
- assertEquals(512, qrStartConfig.jvm().stacksize());
- assertEquals(0, qrStartConfig.jvm().directMemorySizeCache());
- assertEquals(32, qrStartConfig.jvm().compressedClassSpaceSize());
- assertEquals(75, qrStartConfig.jvm().baseMaxDirectMemorySize());
- }
- }
-
- @Test
- public void metrics_proxy_has_expected_qr_start_options() {
- metrics_proxy_has_expected_qr_start_options(self_hosted);
- metrics_proxy_has_expected_qr_start_options(hosted);
-
- // With max heap from feature flag
- metrics_proxy_has_expected_qr_start_options(self_hosted, 123);
- metrics_proxy_has_expected_qr_start_options(hosted, 123);
- }
-
@Test
public void http_handlers_are_set_up() {
VespaModel model = getModel(servicesWithAdminOnly(), self_hosted);
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyModelTester.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyModelTester.java
index 7c31802fb4d..01167e40411 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyModelTester.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyModelTester.java
@@ -15,8 +15,6 @@ import com.yahoo.vespa.model.admin.monitoring.Metric;
import com.yahoo.vespa.model.admin.monitoring.MetricsConsumer;
import com.yahoo.vespa.model.test.VespaModelTester;
-import java.util.Optional;
-
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.TestMode.hosted;
import static com.yahoo.vespa.model.admin.metricsproxy.MetricsProxyModelTester.TestMode.self_hosted;
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java
index 76f34cf4a81..341a90c6618 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ComplexAttributeFieldsValidatorTestCase.java
@@ -15,6 +15,7 @@ import org.junit.rules.ExpectedException;
import org.xml.sax.SAXException;
import java.io.IOException;
+import java.util.List;
import static com.yahoo.config.model.test.TestUtil.joinLines;
@@ -99,17 +100,17 @@ public class ComplexAttributeFieldsValidatorTestCase {
"}"));
}
- private static void createModelAndValidate(String searchDefinition) throws IOException, SAXException {
- DeployState deployState = createDeployState(servicesXml(), searchDefinition);
+ private static void createModelAndValidate(String schema) throws IOException, SAXException {
+ DeployState deployState = createDeployState(servicesXml(), schema);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
ValidationParameters validationParameters = new ValidationParameters(CheckRouting.FALSE);
Validation.validate(model, validationParameters, deployState);
}
- private static DeployState createDeployState(String servicesXml, String searchDefinition) {
+ private static DeployState createDeployState(String servicesXml, String schema) {
ApplicationPackage app = new MockApplicationPackage.Builder()
.withServices(servicesXml)
- .withSearchDefinition(searchDefinition)
+ .withSchemas(List.of(schema))
.build();
return new DeployState.Builder().applicationPackage(app).build();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java
index c8fdb8348c3..45f3b0fcf60 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java
@@ -45,14 +45,6 @@ public class ContentTypeRemovalValidatorTest {
tester.deploy(previous, getServices("book"), Environment.prod, removalOverride); // Allowed due to override
}
- @Test
- public void testNoOverrideNeededinDev() {
- ValidationTester tester = new ValidationTester();
-
- VespaModel previous = tester.deploy(null, getServices("music"), Environment.prod, null).getFirst();
- tester.deploy(previous, getServices("book"), Environment.dev, null);
- }
-
private static String getServices(String documentType) {
return "<services version='1.0'>" +
" <content id='test' version='1.0'>" +
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java
new file mode 100644
index 00000000000..ddeada8b33f
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java
@@ -0,0 +1,64 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.model.application.validation.change;
+
+import com.yahoo.config.application.api.ValidationId;
+import com.yahoo.config.application.api.ValidationOverrides;
+import com.yahoo.config.provision.Environment;
+import com.yahoo.vespa.model.VespaModel;
+import com.yahoo.vespa.model.application.validation.ValidationTester;
+import com.yahoo.yolean.Exceptions;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author bratseth
+ */
+public class RedundancyIncreaseValidatorTest {
+
+ private final ValidationTester tester = new ValidationTester(7);
+
+ @Test
+ public void testRedundancyIncreaseValidation() {
+ VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null).getFirst();
+ try {
+ tester.deploy(previous, getServices(3), Environment.prod, null);
+ fail("Expected exception due to redundancy increase");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("redundancy-increase: " +
+ "Increasing redundancy from 2 to 3 in 'content cluster 'contentClusterId'. " +
+ "This is a safe operation but verify that you have room for a 3/2x increase in content size. " +
+ ValidationOverrides.toAllowMessage(ValidationId.redundancyIncrease),
+ Exceptions.toMessageString(expected));
+ }
+ }
+
+ @Test
+ public void testOverridingContentRemovalValidation() {
+ VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null).getFirst();
+ tester.deploy(previous, getServices(3), Environment.prod, redundancyIncreaseOverride); // Allowed due to override
+ }
+
+ private static String getServices(int redundancy) {
+ return "<services version='1.0'>" +
+ " <content id='contentClusterId' version='1.0'>" +
+ " <redundancy>" + redundancy + "</redundancy>" +
+ " <engine>" +
+ " <proton/>" +
+ " </engine>" +
+ " <documents>" +
+ " <document type='music' mode='index'/>" +
+ " </documents>" +
+ " <nodes count='3'/>" +
+ " </content>" +
+ "</services>";
+ }
+
+ private static final String redundancyIncreaseOverride =
+ "<validation-overrides>\n" +
+ " <allow until='2000-01-03'>redundancy-increase</allow>\n" +
+ "</validation-overrides>\n";
+
+}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/first/RedundancyOnFirstDeploymentValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/first/RedundancyOnFirstDeploymentValidatorTest.java
new file mode 100644
index 00000000000..d59b2f7227c
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/first/RedundancyOnFirstDeploymentValidatorTest.java
@@ -0,0 +1,64 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.model.application.validation.first;
+
+import com.yahoo.config.application.api.ValidationId;
+import com.yahoo.config.application.api.ValidationOverrides;
+import com.yahoo.config.model.deploy.TestProperties;
+import com.yahoo.config.provision.Environment;
+import com.yahoo.vespa.model.application.validation.ValidationTester;
+import com.yahoo.yolean.Exceptions;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author bratseth
+ */
+public class RedundancyOnFirstDeploymentValidatorTest {
+
+ private final ValidationTester tester = new ValidationTester(7, false,
+ new TestProperties().setFirstTimeDeployment(true)
+ .setHostedVespa(true));
+
+ @Test
+ public void testRedundancyOnFirstDeploymentValidation() {
+ try {
+ tester.deploy(null, getServices(1), Environment.prod, null);
+ fail("Expected exception due to redundancy 1");
+ }
+ catch (IllegalArgumentException expected) {
+ assertEquals("redundancy-one: " +
+ "content cluster 'contentClusterId' has redundancy 1, which will cause it to lose data if a node fails. " +
+ "This requires an override on first deployment in a production zone. " +
+ ValidationOverrides.toAllowMessage(ValidationId.redundancyOne),
+ Exceptions.toMessageString(expected));
+ }
+ }
+
+ @Test
+ public void testOverridingRedundancyOnFirstDeploymentValidation() {
+ tester.deploy(null, getServices(1), Environment.prod, redundancyOneOverride); // Allowed due to override
+ }
+
+ private static String getServices(int redundancy) {
+ return "<services version='1.0'>" +
+ " <content id='contentClusterId' version='1.0'>" +
+ " <redundancy>" + redundancy + "</redundancy>" +
+ " <engine>" +
+ " <proton/>" +
+ " </engine>" +
+ " <documents>" +
+ " <document type='music' mode='index'/>" +
+ " </documents>" +
+ " <nodes count='3'/>" +
+ " </content>" +
+ "</services>";
+ }
+
+ private static final String redundancyOneOverride =
+ "<validation-overrides>\n" +
+ " <allow until='2000-01-03'>redundancy-one</allow>\n" +
+ "</validation-overrides>\n";
+
+}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java
index 469e4649c14..4324f257922 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java
@@ -6,10 +6,14 @@ import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.searchdefinition.derived.TestableDeployLogger;
import com.yahoo.text.XML;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.w3c.dom.Document;
import java.util.Optional;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -48,13 +52,19 @@ public class ClusterResourceLimitsTest {
return this;
}
public ClusterResourceLimits build() {
- var builder = new ClusterResourceLimits.Builder(enableFeedBlockInDistributor, false, new BaseDeployLogger());
+ var builder = new ClusterResourceLimits.Builder(enableFeedBlockInDistributor,
+ false,
+ false,
+ new BaseDeployLogger());
builder.setClusterControllerBuilder(ctrlBuilder);
builder.setContentNodeBuilder(nodeBuilder);
return builder.build();
}
}
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Test
public void content_node_limits_are_derived_from_cluster_controller_limits_if_not_set() {
assertLimits(0.4, 0.7, 0.7, 0.85,
@@ -120,26 +130,40 @@ public class ClusterResourceLimitsTest {
}
@Test
- // TODO: Change to expect exception being thrown when no one uses this in hosted
- public void default_resource_limits_when_hosted_and_warning_is_logged() {
+ public void exception_is_thrown_when_resource_limits_are_specified() {
TestableDeployLogger logger = new TestableDeployLogger();
- final boolean hosted = true;
- ClusterResourceLimits.Builder builder = new ClusterResourceLimits.Builder(true, hosted, logger);
- ClusterResourceLimits limits = builder.build(new ModelElement(XML.getDocument("<cluster id=\"test\">" +
- " <tuning>\n" +
- " <resource-limits>\n" +
- " <memory>0.92</memory>\n" +
- " </resource-limits>\n" +
- " </tuning>\n" +
- "</cluster>")
- .getDocumentElement()));
+ buildClusterResourceLimitsAndLogIfSpecified(logger);
+ assertEquals(1, logger.warnings.size());
+ assertEquals("Element 'resource-limits' is not allowed to be set", logger.warnings.get(0));
- assertLimits(0.8, 0.8, limits.getClusterControllerLimits());
- assertLimits(0.9, 0.9, limits.getContentNodeLimits());
+ expectedException.expect(IllegalArgumentException.class);
+ expectedException.expectMessage(containsString("Element 'resource-limits' is not allowed to be set"));
+ buildClusterResourceLimitsAndThrowIfSpecified(logger);
+ }
- assertEquals(1, logger.warnings.size());
- assertEquals("Element resource-limits is not allowed, default limits will be used", logger.warnings.get(0));
+ private void buildClusterResourceLimitsAndThrowIfSpecified(DeployLogger deployLogger) {
+ buildClusterResourceLimits(true, deployLogger);
+ }
+
+ private void buildClusterResourceLimitsAndLogIfSpecified(DeployLogger deployLogger) {
+ buildClusterResourceLimits(false, deployLogger);
+ }
+
+ private void buildClusterResourceLimits(boolean throwIfSpecified, DeployLogger deployLogger) {
+ Document clusterXml = XML.getDocument("<cluster id=\"test\">" +
+ " <tuning>\n" +
+ " <resource-limits>\n" +
+ " <memory>0.92</memory>\n" +
+ " </resource-limits>\n" +
+ " </tuning>\n" +
+ "</cluster>");
+
+ ClusterResourceLimits.Builder builder = new ClusterResourceLimits.Builder(true,
+ true,
+ throwIfSpecified,
+ deployLogger);
+ builder.build(new ModelElement(clusterXml.getDocumentElement()));
}
private void assertLimits(Double expCtrlDisk, Double expCtrlMemory, Double expNodeDisk, Double expNodeMemory, Fixture f) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java
index 8a46aaaa230..27a01750210 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java
@@ -17,12 +17,10 @@ public class DispatchTuningTest {
DispatchTuning dispatch = new DispatchTuning.Builder()
.setMaxHitsPerPartition(69)
.setDispatchPolicy("round-robin")
- .setMinGroupCoverage(7.5)
.setMinActiveDocsCoverage(12.5)
.setTopKProbability(18.3)
.build();
assertEquals(69, dispatch.getMaxHitsPerPartition().intValue());
- assertEquals(7.5, dispatch.getMinGroupCoverage().doubleValue(), 0.0);
assertEquals(12.5, dispatch.getMinActiveDocsCoverage().doubleValue(), 0.0);
assertTrue(DispatchTuning.DispatchPolicy.ROUNDROBIN == dispatch.getDispatchPolicy());
assertEquals(18.3, dispatch.getTopkProbability(), 0.0);
@@ -33,7 +31,6 @@ public class DispatchTuningTest {
.setDispatchPolicy("random")
.build();
assertTrue(DispatchTuning.DispatchPolicy.ADAPTIVE == dispatch.getDispatchPolicy());
- assertNull(dispatch.getMinGroupCoverage());
assertNull(dispatch.getMinActiveDocsCoverage());
}
@@ -43,7 +40,6 @@ public class DispatchTuningTest {
.setDispatchPolicy("adaptive")
.build();
assertTrue(DispatchTuning.DispatchPolicy.ADAPTIVE == dispatch.getDispatchPolicy());
- assertNull(dispatch.getMinGroupCoverage());
assertNull(dispatch.getMinActiveDocsCoverage());
}
@@ -53,7 +49,6 @@ public class DispatchTuningTest {
assertNull(dispatch.getMaxHitsPerPartition());
assertNull(dispatch.getDispatchPolicy());
assertNull(dispatch.getMinActiveDocsCoverage());
- assertNull(dispatch.getMinGroupCoverage());
assertNull(dispatch.getTopkProbability());
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java
index 22e38b30959..10bb00168bb 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java
@@ -4,9 +4,9 @@ package com.yahoo.vespa.model.content;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.deploy.TestProperties;
-import com.yahoo.vespa.config.content.FleetcontrollerConfig;
import com.yahoo.config.model.test.MockRoot;
import com.yahoo.text.XML;
+import com.yahoo.vespa.config.content.FleetcontrollerConfig;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -26,6 +26,7 @@ public class FleetControllerClusterTest {
clusterElement,
new ClusterResourceLimits.Builder(enableFeedBlockInDistributor,
false,
+ false,
new BaseDeployLogger())
.build(clusterElement).getClusterControllerLimits())
.build(root.getDeployState(), root, clusterElement.getXml());
@@ -115,7 +116,7 @@ public class FleetControllerClusterTest {
assertLimits(0.8, 0.7, getConfigForResourceLimitsTuning(null, 0.7));
}
- private static double DELTA = 0.00001;
+ private static final double DELTA = 0.00001;
private void assertLimits(double expDisk, double expMemory, FleetcontrollerConfig config) {
var limits = config.cluster_feed_block_limit();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java
index 3be592e54e7..6c8cb393d3f 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java
@@ -201,7 +201,6 @@ public class IndexedHierarchicDistributionTest {
assertEquals(8, dg.getRowBits());
assertEquals(3, dg.getNumPartitions());
assertEquals(true, dg.useFixedRowInDispatch());
- assertEquals(1, dg.getMaxNodesDownPerFixedRow());
ArrayList<SearchInterface> list = new ArrayList<>();
for(SearchInterface si : dg.getSearchersIterable()) {
list.add(si);
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
index 177b86c953e..e16862230fc 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
@@ -6,7 +6,6 @@ import com.yahoo.messagebus.routing.HopBlueprint;
import com.yahoo.messagebus.routing.PolicyDirective;
import com.yahoo.messagebus.routing.Route;
import com.yahoo.messagebus.routing.RoutingTable;
-import com.yahoo.searchdefinition.parser.ParseException;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.docproc.ContainerDocproc;
@@ -17,50 +16,48 @@ import com.yahoo.vespa.model.routing.Routing;
import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils;
import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.Test;
-import org.xml.sax.SAXException;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author Einar M R Rosenvinge
*/
public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
+
@Test
- public void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain()
- throws IOException, SAXException, ParseException {
+ public void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain() {
final String CLUSTERNAME = "musiccluster";
SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null);
searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
- VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(searchCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(), List.of(searchCluster));
assertIndexing(model, new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing")));
assertFeedingRoute(model, CLUSTERNAME, "container/chain.indexing");
}
@Test
- public void oneContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain()
- throws IOException, SAXException, ParseException {
+ public void oneContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() {
final String CLUSTERNAME = "musicandbookscluster";
SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null);
searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
searchCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
- VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(searchCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(), List.of(searchCluster));
assertIndexing(model, new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing")));
assertFeedingRoute(model, CLUSTERNAME, "container/chain.indexing");
}
@Test
- public void twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain()
- throws IOException, SAXException, ParseException {
+ public void twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() {
final String MUSIC = "musiccluster";
SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, null, null);
musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
@@ -69,10 +66,10 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
SearchClusterSpec booksCluster = new SearchClusterSpec(BOOKS, null, null);
booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
- VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(musicCluster, booksCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(), List.of(musicCluster, booksCluster));
assertIndexing(model,
- new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing")));
+ new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing")));
assertFeedingRoute(model, MUSIC, "container/chain.indexing");
assertFeedingRoute(model, BOOKS, "container/chain.indexing");
@@ -80,19 +77,17 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
@Test
- public void oneContentOneDoctypeExplicitIndexingClusterImplicitIndexingChain()
- throws IOException, SAXException, ParseException {
+ public void oneContentOneDoctypeExplicitIndexingClusterImplicitIndexingChain() {
final String CLUSTERNAME = "musiccluster";
SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, "dpcluster", null);
searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
- VespaModel model = getIndexedContentVespaModel(Arrays.asList(new DocprocClusterSpec("dpcluster")), Arrays.asList(searchCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(new DocprocClusterSpec("dpcluster")), List.of(searchCluster));
assertIndexing(model, new DocprocClusterSpec("dpcluster", new DocprocChainSpec("dpcluster/chain.indexing")));
assertFeedingRoute(model, CLUSTERNAME, "dpcluster/chain.indexing");
}
@Test
- public void oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain()
- throws IOException, SAXException, ParseException {
+ public void oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain() {
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<services version=\"1.0\">\n" +
@@ -130,8 +125,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
}
@Test
- public void twoContentTwoDoctypesExplicitIndexingInSameIndexingCluster()
- throws IOException, SAXException, ParseException {
+ public void twoContentTwoDoctypesExplicitIndexingInSameIndexingCluster() {
final String MUSIC = "musiccluster";
SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpcluster", null);
musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
@@ -140,8 +134,8 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
SearchClusterSpec booksCluster = new SearchClusterSpec(BOOKS, "dpcluster", null);
booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
- VespaModel model = getIndexedContentVespaModel(Arrays.asList(new DocprocClusterSpec("dpcluster")),
- Arrays.asList(musicCluster, booksCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(new DocprocClusterSpec("dpcluster")),
+ List.of(musicCluster, booksCluster));
assertIndexing(model, new DocprocClusterSpec("dpcluster", new DocprocChainSpec("dpcluster/chain.indexing")));
assertFeedingRoute(model, MUSIC, "dpcluster/chain.indexing");
@@ -165,14 +159,12 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
"</services>\n";
List<String> sds = ApplicationPackageUtils.generateSchemas("music", "title", "artist");
- VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(),
- services, sds).create();
+ VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
assertIndexing(model, new DocprocClusterSpec("dokprok"));
}
@Test
- public void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChain()
- throws IOException, SAXException, ParseException {
+ public void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChain() {
final String MUSIC = "musiccluster";
SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpmusiccluster", "dpmusicchain");
musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
@@ -183,12 +175,8 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain", "indexing"));
DocprocClusterSpec dpBooksCluster = new DocprocClusterSpec("dpbookscluster", new DocprocChainSpec("dpbookschain", "indexing"));
- VespaModel model = getIndexedContentVespaModel(Arrays.asList(
- dpMusicCluster,
- dpBooksCluster),
- Arrays.asList(
- musicCluster,
- booksCluster));
+ VespaModel model = getIndexedContentVespaModel(List.of(dpMusicCluster, dpBooksCluster),
+ List.of(musicCluster, booksCluster));
//after we generated model, add indexing chains for validation:
dpMusicCluster.chains.clear();
@@ -204,52 +192,52 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
assertFeedingRoute(model, BOOKS, "dpbookscluster/chain.dpbookschain");
}
- @Test(expected = IllegalArgumentException.class)
- public void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChainIncorrectInheritance()
- throws IOException, SAXException, ParseException {
- final String MUSIC = "musiccluster";
- SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpmusiccluster", "dpmusicchain");
- musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
-
- final String BOOKS = "bookscluster";
- SearchClusterSpec booksCluster = new SearchClusterSpec(BOOKS, "dpbookscluster", "dpbookschain");
- booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
-
- DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain"));
- DocprocClusterSpec dpBooksCluster = new DocprocClusterSpec("dpbookscluster", new DocprocChainSpec("dpbookschain"));
- VespaModel model = getIndexedContentVespaModel(Arrays.asList(
- dpMusicCluster,
- dpBooksCluster),
- Arrays.asList(
- musicCluster,
- booksCluster));
-
- //after we generated model, add indexing chains for validation:
- dpMusicCluster.chains.clear();
- dpMusicCluster.chains.add(new DocprocChainSpec("dpmusiccluster/chain.indexing"));
- dpMusicCluster.chains.add(new DocprocChainSpec("dpmusiccluster/chain.dpmusicchain"));
-
- dpBooksCluster.chains.clear();
- dpBooksCluster.chains.add(new DocprocChainSpec("dpbookscluster/chain.indexing"));
- dpBooksCluster.chains.add(new DocprocChainSpec("dpbookscluster/chain.dpbookschain"));
+ @Test
+ public void requiresIndexingInheritance() {
+ try {
+ SearchClusterSpec musicCluster = new SearchClusterSpec("musiccluster",
+ "dpmusiccluster",
+ "dpmusicchain");
+ musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
+
+ DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain"));
+ getIndexedContentVespaModel(List.of(dpMusicCluster), List.of(musicCluster));
+ fail("Expected exception");
+ }
+ catch (IllegalArgumentException e) {
+ assertEquals("Docproc chain 'dpmusicchain' must inherit from the 'indexing' chain", e.getMessage());
+ }
+ }
- assertIndexing(model, dpMusicCluster, dpBooksCluster);
- assertFeedingRoute(model, MUSIC, "dpmusiccluster/chain.dpmusicchain");
- assertFeedingRoute(model, BOOKS, "dpbookscluster/chain.dpbookschain");
+ @Test
+ public void indexingChainShouldNotBeTheDefaultChain() {
+ try {
+ SearchClusterSpec musicCluster = new SearchClusterSpec("musiccluster",
+ "dpmusiccluster",
+ "default");
+ musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
+
+ DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("default", "indexing"));
+ getIndexedContentVespaModel(List.of(dpMusicCluster), List.of(musicCluster));
+ fail("Expected exception");
+ }
+ catch (IllegalArgumentException e) {
+ assertTrue(e.getMessage().startsWith("Indexing cluster 'musiccluster' specifies the chain 'default' as indexing chain"));
+ }
}
private void assertIndexing(VespaModel model, DocprocClusterSpec... expectedDocprocClusters) {
Map<String, ContainerCluster> docprocClusters = getDocprocClusters(model);
- assertThat(docprocClusters.size(), is(expectedDocprocClusters.length));
+ assertEquals(expectedDocprocClusters.length, docprocClusters.size());
for (DocprocClusterSpec expectedDocprocCluster : expectedDocprocClusters) {
ContainerCluster docprocCluster = docprocClusters.get(expectedDocprocCluster.name);
- assertThat(docprocCluster, not(nullValue()));
- assertThat(docprocCluster.getName(), is(expectedDocprocCluster.name));
+ assertNotNull(docprocCluster);
+ assertEquals(expectedDocprocCluster.name, docprocCluster.getName());
ContainerDocproc containerDocproc = docprocCluster.getDocproc();
- assertThat(containerDocproc, not(nullValue()));
+ assertNotNull(containerDocproc);
List<DocprocChain> chains = containerDocproc.getChains().allChains().allComponents();
- assertThat(chains.size(), is(expectedDocprocCluster.chains.size()));
+ assertEquals(expectedDocprocCluster.chains.size(), chains.size());
List<String> actualDocprocChains = new ArrayList<>();
for (DocprocChain chain : chains) {
actualDocprocChains.add(chain.getServiceName());
@@ -373,7 +361,8 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
return retval.toString();
}
- private String createVespaServicesWithContent(List<DocprocClusterSpec> docprocClusterSpecs, List<SearchClusterSpec> searchClusterSpecs) {
+ private String createVespaServicesWithContent(List<DocprocClusterSpec> docprocClusterSpecs,
+ List<SearchClusterSpec> searchClusterSpecs) {
String mainPre =
"<?xml version='1.0' encoding='utf-8' ?>\n" +
"<services version='1.0'>\n" +
@@ -393,7 +382,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
String docprocCluster = "";
docprocCluster += " <container version='1.0' id='" + docprocClusterSpec.name + "'>\n";
- if (docprocClusterSpec.chains != null && docprocClusterSpec.chains.size() > 0) {
+ if (docprocClusterSpec.chains.size() > 0) {
docprocCluster += " <document-processing>\n";
for (DocprocChainSpec chain : docprocClusterSpec.chains) {
if (chain.inherits.isEmpty()) {
@@ -465,11 +454,12 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
createVespaServicesWithContent(docprocClusterSpecs, searchClusterSpecs), sds).create();
}
- private class SearchClusterSpec {
+ private static class SearchClusterSpec {
+
private final String name;
- private List<SearchDefSpec> searchDefs = new ArrayList<>(2);
- private String indexingClusterName;
- private String indexingChainName;
+ private final List<SearchDefSpec> searchDefs = new ArrayList<>(2);
+ private final String indexingClusterName;
+ private final String indexingChainName;
private SearchClusterSpec(String name, String indexingClusterName, String indexingChainName) {
this.name = name;
@@ -478,10 +468,11 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
}
}
- private class SearchDefSpec {
- private String typeName;
- private String field1Name;
- private String field2Name;
+ private static class SearchDefSpec {
+
+ private final String typeName;
+ private final String field1Name;
+ private final String field2Name;
private SearchDefSpec(String typeName, String field1Name, String field2Name) {
this.typeName = typeName;
@@ -491,6 +482,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
}
private class DocprocClusterSpec {
+
private final String name;
private final List<DocprocChainSpec> chains = new ArrayList<>();
@@ -500,7 +492,8 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
}
}
- private class DocprocChainSpec {
+ private static class DocprocChainSpec {
+
private final String name;
private final List<String> inherits = new ArrayList<>();
@@ -509,4 +502,5 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
this.inherits.addAll(Arrays.asList(inherits));
}
}
+
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
index 5cf57430f91..9a681003293 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java
@@ -17,6 +17,7 @@ import com.yahoo.vespa.config.content.PersistenceConfig;
import com.yahoo.config.model.test.MockRoot;
import com.yahoo.documentmodel.NewDocumentType;
import static com.yahoo.vespa.defaults.Defaults.getDefaults;
+import static com.yahoo.config.model.test.TestUtil.joinLines;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
import com.yahoo.vespa.model.content.storagecluster.StorageCluster;
import com.yahoo.vespa.model.content.utils.ContentClusterUtils;
@@ -44,10 +45,17 @@ public class StorageClusterTest {
return parse(xml, root);
}
- StorageCluster parse(String xml) {
- MockRoot root = new MockRoot();
+ StorageCluster parse(String xml, ModelContext.Properties properties) {
+ MockRoot root = new MockRoot("",
+ new DeployState.Builder()
+ .properties(properties)
+ .applicationPackage(new MockApplicationPackage.Builder().build())
+ .build());
return parse(xml, root);
}
+ StorageCluster parse(String xml) {
+ return parse(xml, new TestProperties());
+ }
StorageCluster parse(String xml, MockRoot root) {
root.getDeployState().getDocumentModel().getDocumentManager().add(
new NewDocumentType(new NewDocumentType.Name("music"))
@@ -61,13 +69,23 @@ public class StorageClusterTest {
return cluster.getStorageNodes();
}
+ private static String group() {
+ return joinLines(
+ "<group>",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ "</group>");
+ }
+ private static String cluster(String clusterName, String insert) {
+ return joinLines(
+ "<content id=\"" + clusterName + "\">",
+ "<documents/>",
+ insert,
+ group(),
+ "</content>");
+ }
@Test
public void testBasics() {
- StorageCluster storage = parse("<content id=\"foofighters\"><documents/>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</content>\n");
+ StorageCluster storage = parse(cluster("foofighters", ""));
assertEquals(1, storage.getChildren().size());
StorServerConfig.Builder builder = new StorServerConfig.Builder();
@@ -79,11 +97,7 @@ public class StorageClusterTest {
}
@Test
public void testCommunicationManagerDefaults() {
- StorageCluster storage = parse("<content id=\"foofighters\"><documents/>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</content>\n");
+ StorageCluster storage = parse(cluster("foofighters", ""));
StorCommunicationmanagerConfig.Builder builder = new StorCommunicationmanagerConfig.Builder();
storage.getChildren().get("0").getConfig(builder);
StorCommunicationmanagerConfig config = new StorCommunicationmanagerConfig(builder);
@@ -97,40 +111,49 @@ public class StorageClusterTest {
}
@Test
+ public void testMergeDefaults() {
+ StorServerConfig.Builder builder = new StorServerConfig.Builder();
+ parse(cluster("foofighters", "")).getConfig(builder);
+
+ StorServerConfig config = new StorServerConfig(builder);
+ assertEquals(16, config.max_merges_per_node());
+ assertEquals(1024, config.max_merge_queue_size());
+ }
+
+ @Test
public void testMerges() {
StorServerConfig.Builder builder = new StorServerConfig.Builder();
- parse("" +
- "<content id=\"foofighters\">\n" +
- " <documents/>" +
- " <tuning>" +
- " <merges max-per-node=\"1K\" max-queue-size=\"10K\"/>\n" +
- " </tuning>" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</content>"
+ parse(cluster("foofighters", joinLines(
+ "<tuning>",
+ " <merges max-per-node=\"1K\" max-queue-size=\"10K\"/>",
+ "</tuning>")),
+ new TestProperties().setMaxMergeQueueSize(1919).setMaxConcurrentMergesPerNode(37)
).getConfig(builder);
StorServerConfig config = new StorServerConfig(builder);
assertEquals(1024, config.max_merges_per_node());
assertEquals(1024*10, config.max_merge_queue_size());
}
+ @Test
+ public void testMergeFeatureFlags() {
+ StorServerConfig.Builder builder = new StorServerConfig.Builder();
+ parse(cluster("foofighters", ""), new TestProperties().setMaxMergeQueueSize(1919).setMaxConcurrentMergesPerNode(37)).getConfig(builder);
+
+ StorServerConfig config = new StorServerConfig(builder);
+ assertEquals(37, config.max_merges_per_node());
+ assertEquals(1919, config.max_merge_queue_size());
+ }
@Test
public void testVisitors() {
StorVisitorConfig.Builder builder = new StorVisitorConfig.Builder();
- parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " <visitors thread-count=\"7\" max-queue-size=\"1000\">\n" +
- " <max-concurrent fixed=\"42\" variable=\"100\"/>\n" +
- " </visitors>\n" +
- " </tuning>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>"
+ parse(cluster("bees",
+ joinLines(
+ "<tuning>",
+ " <visitors thread-count=\"7\" max-queue-size=\"1000\">",
+ " <max-concurrent fixed=\"42\" variable=\"100\"/>",
+ " </visitors>",
+ "</tuning>"))
).getConfig(builder);
StorVisitorConfig config = new StorVisitorConfig(builder);
@@ -143,16 +166,10 @@ public class StorageClusterTest {
@Test
public void testPersistenceThreads() {
- StorageCluster stc = parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " <persistence-threads count=\"7\"/>\n" +
- " </tuning>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>",
+ StorageCluster stc = parse(cluster("bees",joinLines(
+ "<tuning>",
+ " <persistence-threads count=\"7\"/>",
+ "</tuning>")),
new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build())
);
@@ -178,16 +195,10 @@ public class StorageClusterTest {
@Test
public void testResponseThreads() {
- StorageCluster stc = parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " <persistence-threads count=\"7\"/>\n" +
- " </tuning>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>",
+ StorageCluster stc = parse(cluster("bees",joinLines(
+ "<tuning>",
+ " <persistence-threads count=\"7\"/>",
+ "</tuning>")),
new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build())
);
StorFilestorConfig.Builder builder = new StorFilestorConfig.Builder();
@@ -201,20 +212,14 @@ public class StorageClusterTest {
@Test
public void testPersistenceThreadsOld() {
- StorageCluster stc = parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " <persistence-threads>\n" +
- " <thread lowest-priority=\"VERY_LOW\" count=\"2\"/>\n" +
- " <thread lowest-priority=\"VERY_HIGH\" count=\"1\"/>\n" +
- " <thread count=\"1\"/>\n" +
- " </persistence-threads>\n" +
- " </tuning>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>",
+ StorageCluster stc = parse(cluster("bees", joinLines(
+ "<tuning>",
+ " <persistence-threads>",
+ " <thread lowest-priority=\"VERY_LOW\" count=\"2\"/>",
+ " <thread lowest-priority=\"VERY_HIGH\" count=\"1\"/>",
+ " <thread count=\"1\"/>",
+ " </persistence-threads>",
+ "</tuning>")),
new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build())
);
@@ -238,15 +243,7 @@ public class StorageClusterTest {
@Test
public void testNoPersistenceThreads() {
- StorageCluster stc = parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " </tuning>\n" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>",
+ StorageCluster stc = parse(cluster("bees", ""),
new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build())
);
@@ -267,13 +264,7 @@ public class StorageClusterTest {
}
private StorageCluster simpleCluster(ModelContext.Properties properties) {
- return parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>",
+ return parse(cluster("bees", ""),
new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build()),
properties);
}
@@ -302,14 +293,7 @@ public class StorageClusterTest {
@Test
public void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() {
StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder();
- parse(
- "<cluster id=\"bees\">\n" +
- " <documents/>" +
- " <group>" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" +
- " </group>" +
- "</cluster>"
- ).getConfig(builder);
+ parse(cluster("bees", "")).getConfig(builder);
StorIntegritycheckerConfig config = new StorIntegritycheckerConfig(builder);
// '-' --> don't run on the given week day
assertEquals("-------", config.weeklycycle());
@@ -317,15 +301,15 @@ public class StorageClusterTest {
@Test
public void testCapacity() {
- String xml =
- "<cluster id=\"storage\">\n" +
- " <documents/>" +
- " <group>\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " <node distribution-key=\"1\" hostalias=\"mockhost\" capacity=\"1.5\"/>\n" +
- " <node distribution-key=\"2\" hostalias=\"mockhost\" capacity=\"2.0\"/>\n" +
- " </group>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <documents/>",
+ " <group>",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " <node distribution-key=\"1\" hostalias=\"mockhost\" capacity=\"1.5\"/>",
+ " <node distribution-key=\"2\" hostalias=\"mockhost\" capacity=\"2.0\"/>",
+ " </group>",
+ "</cluster>");
ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
@@ -341,15 +325,7 @@ public class StorageClusterTest {
@Test
public void testRootFolder() {
- String xml =
- "<cluster id=\"storage\">\n" +
- " <documents/>" +
- " <group>\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- "</cluster>";
-
- ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
+ ContentCluster cluster = ContentClusterUtils.createCluster(cluster("storage", ""), new MockRoot());
StorageNode node = cluster.getStorageNodes().getChildren().get("0");
@@ -372,18 +348,18 @@ public class StorageClusterTest {
@Test
public void testGenericPersistenceTuning() {
- String xml =
- "<cluster id=\"storage\">\n" +
- "<documents/>" +
- "<engine>\n" +
- " <fail-partition-on-error>true</fail-partition-on-error>\n" +
- " <revert-time>34m</revert-time>\n" +
- " <recovery-time>5d</recovery-time>\n" +
- "</engine>" +
- " <group>\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <documents/>",
+ " <engine>",
+ " <fail-partition-on-error>true</fail-partition-on-error>",
+ " <revert-time>34m</revert-time>",
+ " <recovery-time>5d</recovery-time>",
+ " </engine>",
+ " <group>",
+ " node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " </group>",
+ "</cluster>");
ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
@@ -398,21 +374,21 @@ public class StorageClusterTest {
@Test
public void requireThatUserDoesNotSpecifyBothGroupAndNodes() {
- String xml =
- "<cluster id=\"storage\">\n" +
- "<documents/>\n" +
- "<engine>\n" +
- " <fail-partition-on-error>true</fail-partition-on-error>\n" +
- " <revert-time>34m</revert-time>\n" +
- " <recovery-time>5d</recovery-time>\n" +
- "</engine>" +
- " <group>\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " <nodes>\n" +
- " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" +
- " </nodes>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <documents/>",
+ " <engine>",
+ " <fail-partition-on-error>true</fail-partition-on-error>",
+ " <revert-time>34m</revert-time>",
+ " <recovery-time>5d</recovery-time>",
+ " </engine>",
+ " <group>",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " <nodes>",
+ " <node distribution-key=\"1\" hostalias=\"mockhost\"/>",
+ " </nodes>",
+ "</cluster>");
try {
final MockRoot root = new MockRoot();
@@ -429,20 +405,20 @@ public class StorageClusterTest {
@Test
public void requireThatGroupNamesMustBeUniqueAmongstSiblings() {
- String xml =
- "<cluster id=\"storage\">\n" +
- " <redundancy>2</redundancy>" +
- " <documents/>\n" +
- " <group>\n" +
- " <distribution partitions=\"*\"/>\n" +
- " <group distribution-key=\"0\" name=\"bar\">\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " <group distribution-key=\"0\" name=\"bar\">\n" +
- " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " </group>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <redundancy>2</redundancy>",
+ " <documents/>",
+ " <group>",
+ " <distribution partitions=\"*\"/>",
+ " <group distribution-key=\"0\" name=\"bar\">",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " <group distribution-key=\"0\" name=\"bar\">",
+ " <node distribution-key=\"1\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " </group>",
+ "</cluster>");
try {
ContentClusterUtils.createCluster(xml, new MockRoot());
@@ -455,24 +431,24 @@ public class StorageClusterTest {
@Test
public void requireThatGroupNamesCanBeDuplicatedAcrossLevels() {
- String xml =
- "<cluster id=\"storage\">\n" +
- " <redundancy>2</redundancy>" +
- "<documents/>\n" +
- " <group>\n" +
- " <distribution partitions=\"*\"/>\n" +
- " <group distribution-key=\"0\" name=\"bar\">\n" +
- " <group distribution-key=\"0\" name=\"foo\">\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " </group>\n" +
- " <group distribution-key=\"0\" name=\"foo\">\n" +
- " <group distribution-key=\"0\" name=\"bar\">\n" +
- " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " </group>\n" +
- " </group>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <redundancy>2</redundancy>",
+ " <documents/>",
+ " <group>",
+ " <distribution partitions=\"*\"/>",
+ " <group distribution-key=\"0\" name=\"bar\">",
+ " <group distribution-key=\"0\" name=\"foo\">",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " </group>",
+ " <group distribution-key=\"0\" name=\"foo\">",
+ " <group distribution-key=\"0\" name=\"bar\">",
+ " <node distribution-key=\"1\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " </group>",
+ " </group>",
+ "</cluster>");
// Should not throw.
ContentClusterUtils.createCluster(xml, new MockRoot());
@@ -480,18 +456,18 @@ public class StorageClusterTest {
@Test
public void requireThatNestedGroupsRequireDistribution() {
- String xml =
- "<cluster id=\"storage\">\n" +
- "<documents/>\n" +
- " <group>\n" +
- " <group distribution-key=\"0\" name=\"bar\">\n" +
- " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " <group distribution-key=\"0\" name=\"baz\">\n" +
- " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" +
- " </group>\n" +
- " </group>\n" +
- "</cluster>";
+ String xml = joinLines(
+ "<cluster id=\"storage\">",
+ " <documents/>",
+ " <group>",
+ " <group distribution-key=\"0\" name=\"bar\">",
+ " <node distribution-key=\"0\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " <group distribution-key=\"0\" name=\"baz\">",
+ " <node distribution-key=\"1\" hostalias=\"mockhost\"/>",
+ " </group>",
+ " </group>",
+ "</cluster>");
try {
ContentClusterUtils.createCluster(xml, new MockRoot());
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
index 7c93b4ef02b..1426b094971 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
@@ -15,9 +15,7 @@ import java.util.List;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -75,7 +73,6 @@ public class ClusterTest {
joinLines(
"<max-hits-per-partition>77</max-hits-per-partition>",
"<dispatch-policy>round-robin</dispatch-policy>",
- "<min-group-coverage>13</min-group-coverage>",
"<min-active-docs-coverage>93</min-active-docs-coverage>",
"<top-k-probability>0.777</top-k-probability>"),
false);
@@ -84,7 +81,6 @@ public class ClusterTest {
DispatchConfig config = new DispatchConfig(builder);
assertEquals(2, config.searchableCopies());
assertEquals(93.0, config.minActivedocsPercentage(), DELTA);
- assertEquals(13.0, config.minGroupCoverage(), DELTA);
assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, config.distributionPolicy());
assertEquals(77, config.maxHitsPerNode());
assertEquals(0.777, config.topKProbability(), DELTA);
@@ -99,7 +95,6 @@ public class ClusterTest {
DispatchConfig config = new DispatchConfig(builder);
assertEquals(2, config.searchableCopies());
assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, config.distributionPolicy());
- assertEquals(0, config.maxNodesDownPerGroup());
assertEquals(1.0, config.maxWaitAfterCoverageFactor(), DELTA);
assertEquals(0, config.minWaitAfterCoverageFactor(), DELTA);
assertEquals(8, config.numJrtConnectionsPerNode());
@@ -179,7 +174,7 @@ public class ClusterTest {
" </tuning>",
" </content>",
"</services>"))
- .withSchemas(ApplicationPackageUtils.generateSearchDefinition("my_document"))
+ .withSchemas(ApplicationPackageUtils.generateSchemas("my_document"))
.build();
List<Content> contents = new TestDriver().buildModel(app).getConfigModels(Content.class);
assertEquals(1, contents.size());
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java
index abfb03e41dd..7533bf1ef9d 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java
@@ -44,7 +44,6 @@ public class DomDispatchTuningBuilderTest {
" </tuning>" +
"</content>");
assertNull(dispatch.getMaxHitsPerPartition());
- assertNull(dispatch.getMinGroupCoverage());
assertNull(dispatch.getMinActiveDocsCoverage());
assertNull(dispatch.getDispatchPolicy());
assertNull(dispatch.getTopkProbability());
@@ -57,14 +56,12 @@ public class DomDispatchTuningBuilderTest {
" <tuning>" +
" <dispatch>" +
" <max-hits-per-partition>69</max-hits-per-partition>" +
- " <min-group-coverage>7.5</min-group-coverage>" +
" <min-active-docs-coverage>12.5</min-active-docs-coverage>" +
" <top-k-probability>0.999</top-k-probability>" +
" </dispatch>" +
" </tuning>" +
"</content>");
assertEquals(69, dispatch.getMaxHitsPerPartition().intValue());
- assertEquals(7.5, dispatch.getMinGroupCoverage().doubleValue(), 0.0);
assertEquals(12.5, dispatch.getMinActiveDocsCoverage().doubleValue(), 0.0);
assertEquals(0.999, dispatch.getTopkProbability().doubleValue(), 0.0);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
index 9eb7ca0ac02..2b36bfc47b2 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
@@ -192,7 +192,7 @@ public class VespaModelTestCase {
" </documents>" +
"</content>" +
"</services>",
- ApplicationPackageUtils.generateSearchDefinition("music"))
+ ApplicationPackageUtils.generateSchemas("music"))
.create();
MessagebusConfig.Builder mBusB = new MessagebusConfig.Builder();
model.getConfig(mBusB, "client");
@@ -316,10 +316,18 @@ public class VespaModelTestCase {
.build();
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
Validation.validate(model, new ValidationParameters(), deployState);
+ assertContainsWarning(logger.msgs, "Directory searchdefinitions/ should not be used for schemas, use schemas/ instead");
+ }
- assertEquals(3, logger.msgs.size());
- assertEquals("WARNING", logger.msgs.get(1).getFirst().getName());
- assertEquals("Directory searchdefinitions/ should not be used for schemas, use schemas/ instead", logger.msgs.get(1).getSecond());
+ private void assertContainsWarning(List<Pair<Level,String>> msgs, String text) {
+ boolean foundCorrectWarning = false;
+ for (var msg : msgs)
+ if (msg.getFirst().getName().equals("WARNING") && msg.getSecond().equals(text)) {
+ foundCorrectWarning = true;
+ }
+ if (! foundCorrectWarning) for (var msg : msgs) System.err.println("MSG: "+msg);
+ assertTrue(msgs.size() > 0);
+ assertTrue(foundCorrectWarning);
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java
index ba975e52d1a..7e34e9efbbf 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java
@@ -21,7 +21,6 @@ import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.ProvisionLogger;
import com.yahoo.config.provision.Zone;
import com.yahoo.vespa.model.VespaModel;
-import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils;
import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import java.util.ArrayList;
@@ -31,6 +30,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import static com.yahoo.vespa.model.test.utils.ApplicationPackageUtils.generateSchemas;
+
/**
* Helper class which sets up a system with multiple hosts.
* Usage:
@@ -168,7 +169,7 @@ public class VespaModelTester {
boolean alwaysReturnOneNode,
int startIndexForClusters, Optional<VespaModel> previousModel,
DeployState.Builder deployStatebuilder, String ... retiredHostNames) {
- VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
+ VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, generateSchemas("type1"));
ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
provisioner = hosted ? new ProvisionerAdapter(new InMemoryProvisioner(hostsByResources,
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
index df62a3bff07..1f7deaf1991 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
@@ -1,4 +1,4 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.test.utils;
import java.util.ArrayList;
@@ -43,10 +43,6 @@ public class ApplicationPackageUtils {
"}";
}
- public static List<String> generateSearchDefinition(String name) {
- return generateSchemas(name);
- }
-
public static List<String> generateSchemas(String ... sdNames) {
return generateSchemas(Arrays.asList(sdNames));
}