aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2019-09-23 16:12:12 +0200
committerGitHub <noreply@github.com>2019-09-23 16:12:12 +0200
commit5d9cf7eab1eac805b933d07321d95524a8cb2164 (patch)
tree2980ee536afafa6126e1b783554d4e7f9e0a9cd2 /config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java
parent8affeae3e0659a7254aea22582919b85a412a8fe (diff)
Revert "Balder/remove tld from config model rebased"
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java47
1 files changed, 44 insertions, 3 deletions
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 d290d4ec953..afedbaea779 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
@@ -2,6 +2,7 @@
package com.yahoo.vespa.model.content;
import com.yahoo.vespa.config.content.StorDistributionConfig;
+import com.yahoo.vespa.config.search.core.PartitionsConfig;
import com.yahoo.config.model.test.MockRoot;
import com.yahoo.vespa.model.Host;
import com.yahoo.vespa.model.HostResource;
@@ -20,6 +21,8 @@ import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.hamcrest.Matchers.containsString;
import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createCluster;
import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createClusterXml;
+import static com.yahoo.vespa.model.search.utils.DispatchUtils.assertEngine;
+import static com.yahoo.vespa.model.search.utils.DispatchUtils.getDataset;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
@@ -32,13 +35,19 @@ import static org.junit.Assert.assertTrue;
*/
public class IndexedHierarchicDistributionTest {
+ private ContentCluster addDispatcher(ContentCluster c) {
+ MockRoot root = new MockRoot("");
+ c.getSearch().getIndexed().addTld(root.deployLogger(), new SimpleConfigProducer(root, ""), new HostResource(new Host(root, "mockhost")));
+ return c;
+ }
+
private ContentCluster getOneGroupCluster() throws Exception {
String groupXml = joinLines(" <group>",
" <node distribution-key='0' hostalias='mockhost'/>",
" <node distribution-key='1' hostalias='mockhost'/>",
" <node distribution-key='2' hostalias='mockhost'/>",
" </group>", "");
- return createCluster(createClusterXml(groupXml, 2, 2));
+ return addDispatcher(createCluster(createClusterXml(groupXml, 2, 2)));
}
private String getTwoGroupsXml(String partitions) {
@@ -58,11 +67,11 @@ public class IndexedHierarchicDistributionTest {
}
private ContentCluster getTwoGroupsCluster() throws Exception {
- return createCluster(createClusterXml(getTwoGroupsXml("3|*"), 6, 6));
+ return addDispatcher(createCluster(createClusterXml(getTwoGroupsXml("3|*"), 6, 6)));
}
private ContentCluster getTwoGroupsCluster(int redundancy, int searchableCopies, String partitions) throws Exception {
- return createCluster(createClusterXml(getTwoGroupsXml(partitions), redundancy, searchableCopies));
+ return addDispatcher(createCluster(createClusterXml(getTwoGroupsXml(partitions), redundancy, searchableCopies)));
}
private void assertSearchNode(int expRowId, int expPartitionId, int expDistibutionKey, SearchNode node) {
@@ -89,6 +98,20 @@ public class IndexedHierarchicDistributionTest {
}
@Test
+ public void requireThatDispatcherIsCorrectWithOneGroup() throws Exception {
+ ContentCluster c = getOneGroupCluster();
+ PartitionsConfig.Dataset dataset = getDataset(c.getSearch().getIndexed().getTLDs().get(0));
+
+ assertEquals(3, dataset.numparts());
+ assertEquals(PartitionsConfig.Dataset.Querydistribution.AUTOMATIC, dataset.querydistribution());
+ List<PartitionsConfig.Dataset.Engine> engines = dataset.engine();
+ assertEquals(3, engines.size());
+ assertEngine(0, 0, engines.get(0));
+ assertEngine(0, 1, engines.get(1));
+ assertEngine(0, 2, engines.get(2));
+ }
+
+ @Test
public void requireThatActivePerLeafGroupIsDefaultWithOneGroup() throws Exception {
ContentCluster c = getOneGroupCluster();
assertFalse(getStorDistributionConfig(c).active_per_leaf_group());
@@ -109,6 +132,24 @@ public class IndexedHierarchicDistributionTest {
}
@Test
+ public void requireThatDispatcherIsCorrectWithTwoGroups() throws Exception {
+ ContentCluster c = getTwoGroupsCluster();
+ PartitionsConfig.Dataset dataset = getDataset(c.getSearch().getIndexed().getTLDs().get(0));
+
+ assertEquals(3, dataset.numparts());
+ assertEquals(2, dataset.maxnodesdownperfixedrow());
+ assertEquals(PartitionsConfig.Dataset.Querydistribution.FIXEDROW, dataset.querydistribution());
+ List<PartitionsConfig.Dataset.Engine> engines = dataset.engine();
+ assertEquals(6, engines.size());
+ assertEngine(0, 0, engines.get(0));
+ assertEngine(1, 0, engines.get(1));
+ assertEngine(0, 1, engines.get(2));
+ assertEngine(1, 1, engines.get(3));
+ assertEngine(0, 2, engines.get(4));
+ assertEngine(1, 2, engines.get(5));
+ }
+
+ @Test
public void requireThatActivePerLeafGroupIsSetWithTwoGroups() throws Exception {
ContentCluster c = getTwoGroupsCluster();
assertTrue(getStorDistributionConfig(c).active_per_leaf_group());