Search in sources :

Example 16 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.

the class ModelProvisioningTest method testExplicitDedicatedClusterControllers.

@Test
public void testExplicitDedicatedClusterControllers() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <container version='1.0' id='foo'>" + "     <nodes count='10'/>" + "  </container>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <controllers><nodes dedicated='true' count='4'/></controllers>" + "     <nodes count='9' groups='3'/>" + "  </content>" + "</services>";
    int numberOfHosts = 23;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check content clusters
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(4, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default04", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default02", clusterControllers.getContainers().get(2).getHostName());
    assertEquals("default01", clusterControllers.getContainers().get(3).getHostName());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 17 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.

the class ModelProvisioningTest method require_that_proton_config_is_tuned_based_on_node_flavor.

@Test
public void require_that_proton_config_is_tuned_based_on_node_flavor() {
    String services = joinLines("<?xml version='1.0' encoding='utf-8' ?>", "<services>", "  <content version='1.0' id='test'>", "     <documents>", "       <document type='type1' mode='index'/>", "     </documents>", "     <nodes count='2' flavor='content-test-flavor'/>", "  </content>", "</services>");
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(createFlavorFromDiskSetting("content-test-flavor", false), 2);
    VespaModel model = tester.createModel(services, true, 0);
    ContentSearchCluster cluster = model.getContentClusters().get("test").getSearch();
    assertEquals(2, cluster.getSearchNodes().size());
    assertEquals(40, getProtonConfig(cluster, 0).hwinfo().disk().writespeed(), 0.001);
    assertEquals(40, getProtonConfig(cluster, 1).hwinfo().disk().writespeed(), 0.001);
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 18 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.

the class ModelProvisioningTest method testJDiscOnly.

@Test
public void testJDiscOnly() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<jdisc version='1.0'>" + "  <search/>" + "  <nodes count='3'/>" + "</jdisc>";
    int numberOfHosts = 3;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertEquals(numberOfHosts, model.getRoot().getHostSystem().getHosts().size());
    assertEquals(3, model.getContainerClusters().get("jdisc").getContainers().size());
    assertNotNull(model.getAdmin().getLogserver());
    assertEquals(3, model.getAdmin().getSlobroks().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 19 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.

the class ModelProvisioningTest method testSlobroksAreSpreadOverAllContainerClustersExceptNodeAdmin.

@Test
public void testSlobroksAreSpreadOverAllContainerClustersExceptNodeAdmin() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='4.0'/>" + "  <container version='1.0' id='routing'>" + "     <nodes count='10'/>" + "  </container>" + "  <container version='1.0' id='node-admin'>" + "     <nodes count='3'/>" + "  </container>" + "</services>";
    int numberOfHosts = 13;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    tester.setApplicationId("hosted-vespa", "routing", "default");
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    Set<String> routingHosts = getClusterHostnames(model, "routing");
    assertEquals(10, routingHosts.size());
    Set<String> nodeAdminHosts = getClusterHostnames(model, "node-admin");
    assertEquals(3, nodeAdminHosts.size());
    Set<String> slobrokHosts = model.getAdmin().getSlobroks().stream().map(AbstractService::getHostName).collect(Collectors.toSet());
    assertEquals(3, slobrokHosts.size());
    assertThat(slobrokHosts, everyItem(isIn(routingHosts)));
    assertThat(slobrokHosts, everyItem(not(isIn(nodeAdminHosts))));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 20 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.

the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingJustOneNode.

@Test
public void testUsingNodesCountAttributesAndGettingJustOneNode() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='3.0'>" + // Ignored
    "    <nodes count='3'/>" + "  </admin>" + "  <content version='1.0' id='bar'>" + "     <redundancy reply-after='8'>12</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='24'/>" + "     <engine><proton><searchable-copies>5</searchable-copies></proton></engine>" + "     <dispatch><num-dispatch-groups>7</num-dispatch-groups></dispatch>" + "  </content>" + "</services>";
    int numberOfHosts = 1;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, false);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    assertEquals(1, cluster.redundancy().effectiveInitialRedundancy());
    assertEquals(1, cluster.redundancy().effectiveFinalRedundancy());
    assertEquals(1, cluster.redundancy().effectiveReadyCopies());
    assertEquals(1, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
    assertFalse(cluster.getRootGroup().getPartitions().isPresent());
    assertEquals(1, cluster.getRootGroup().getNodes().size());
    assertEquals(0, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getNodes().size(), is(1));
    assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)38 Test (org.junit.Test)38 VespaModel (com.yahoo.vespa.model.VespaModel)35 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)15 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)11 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)2 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)1 HostResource (com.yahoo.vespa.model.HostResource)1 Admin (com.yahoo.vespa.model.admin.Admin)1 Container (com.yahoo.vespa.model.container.Container)1 StorageNode (com.yahoo.vespa.model.content.StorageNode)1 Map (java.util.Map)1 Ignore (org.junit.Ignore)1