summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-09-23 10:43:07 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-09-23 10:56:14 +0200
commit8d240397326f86f4f244c822b44e97bac9c5bff2 (patch)
tree46202f924dc0b4ce20c9af7ae288c52ca98e6cdd /config-model
parented30b41deb35c9a3141edd5b70ab5fc72e802bee (diff)
Add some minimal dispatchconfig tests.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java24
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java47
2 files changed, 67 insertions, 4 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
index f1945fe67ae..d6579ba88d4 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
@@ -18,6 +18,7 @@ import com.yahoo.vespa.config.content.StorDistributionConfig;
import com.yahoo.vespa.config.content.StorFilestorConfig;
import com.yahoo.vespa.config.content.core.StorDistributormanagerConfig;
import com.yahoo.vespa.config.content.core.StorServerConfig;
+import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.config.search.core.ProtonConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.container.ContainerCluster;
@@ -930,4 +931,27 @@ public class ContentClusterTest extends ContentBaseTest {
assertEquals(distributionBits, storDistributormanagerConfig.minsplitcount());
}
+ private void verifyRoundRobinPropertiesControl(boolean useAdaptiveDispatch) {
+ VespaModel model = createEnd2EndOneNode(new TestProperties().setUseAdaptiveDispatch(useAdaptiveDispatch));
+
+ ContentCluster cc = model.getContentClusters().get("storage");
+ DispatchConfig.Builder builder = new DispatchConfig.Builder();
+ cc.getSearch().getConfig(builder);
+
+ DispatchConfig cfg = new DispatchConfig(builder);
+ if (useAdaptiveDispatch) {
+ assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, cfg.distributionPolicy());
+ } else {
+ assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, cfg.distributionPolicy());
+ }
+
+ }
+
+ @Test
+ public void default_dispatch_controlled_by_properties() {
+ verifyRoundRobinPropertiesControl(false);
+ verifyRoundRobinPropertiesControl(true);
+ }
+
+
}
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 e67a75d747c..c7c76257778 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
@@ -4,6 +4,7 @@ package com.yahoo.vespa.model.content.cluster;
import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.model.test.TestDriver;
+import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.config.search.core.ProtonConfig;
import com.yahoo.vespa.model.content.Content;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
@@ -21,6 +22,7 @@ import static org.junit.Assert.assertNotNull;
*/
public class ClusterTest {
+ static final double DELTA = 1E-12;
@Test
public void requireThatContentSearchIsApplied() {
ContentCluster cluster = newContentCluster(joinLines("<search>",
@@ -29,10 +31,10 @@ public class ClusterTest {
"</search>"));
IndexedSearchCluster searchCluster = cluster.getSearch().getIndexed();
assertNotNull(searchCluster);
- assertEquals(1.1, searchCluster.getQueryTimeout(), 1E-6);
- assertEquals(2.3, searchCluster.getVisibilityDelay(), 1E-6);
+ assertEquals(1.1, searchCluster.getQueryTimeout(), DELTA);
+ assertEquals(2.3, searchCluster.getVisibilityDelay(), DELTA);
ProtonConfig proton = getProtonConfig(cluster);
- assertEquals(searchCluster.getVisibilityDelay(), proton.documentdb(0).visibilitydelay(), 1E-6);
+ assertEquals(searchCluster.getVisibilityDelay(), proton.documentdb(0).visibilitydelay(), DELTA);
}
@Test
@@ -41,7 +43,44 @@ public class ClusterTest {
" <visibility-delay>2.3</visibility-delay>",
"</search>"), true);
ProtonConfig proton = getProtonConfig(cluster);
- assertEquals(0.0, proton.documentdb(0).visibilitydelay(), 1E-6);
+ assertEquals(0.0, proton.documentdb(0).visibilitydelay(), DELTA);
+ }
+
+ @Test
+ public void requireThatSearchCoverageIsApplied() {
+ ContentCluster cluster = newContentCluster(joinLines("<search>",
+ " <coverage>",
+ " <minimum>0.11</minimum>",
+ " <min-wait-after-coverage-factor>0.23</min-wait-after-coverage-factor>",
+ " <max-wait-after-coverage-factor>0.58</max-wait-after-coverage-factor>",
+ " </coverage>",
+ "</search>"));
+ DispatchConfig.Builder builder = new DispatchConfig.Builder();
+ cluster.getSearch().getConfig(builder);
+ DispatchConfig config = new DispatchConfig(builder);
+ assertEquals(11.0, config.minSearchCoverage(), DELTA);
+ assertEquals(0.23, config.minWaitAfterCoverageFactor(), DELTA);
+ assertEquals(0.58, config.maxWaitAfterCoverageFactor(), DELTA);
+ assertEquals(2, config.searchableCopies());
+ assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, config.distributionPolicy());
+ }
+
+ @Test
+ public void requireThatDefaultDispatchConfigIsCorrect() {
+ ContentCluster cluster = newContentCluster(joinLines("<search>", "</search>"),
+ joinLines("<tuning>", "</tuning>"));
+ DispatchConfig.Builder builder = new DispatchConfig.Builder();
+ cluster.getSearch().getConfig(builder);
+ DispatchConfig config = new DispatchConfig(builder);
+ assertEquals(2, config.searchableCopies());
+ assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, config.distributionPolicy());
+ assertEquals(0, config.maxNodesDownPerGroup());
+ assertEquals(1.0, config.maxWaitAfterCoverageFactor(), DELTA);
+ assertEquals(0, config.minWaitAfterCoverageFactor(), DELTA);
+ }
+
+ private static ContentCluster newContentCluster(String contentSearchXml, String searchNodeTuningXml) {
+ return newContentCluster(contentSearchXml, searchNodeTuningXml, false);
}
private static ContentCluster newContentCluster(String contentSearchXml) {