Search in sources :

Example 16 with VespaModel

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

the class ModelProvisioningTest method testRequestingSpecificFlavors.

@Test
public void testRequestingSpecificFlavors() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='4.0'>" + "     <logservers><nodes count='1' dedicated='true' flavor='logserver-flavor'/></logservers>" + "     <slobroks><nodes count='2' dedicated='true' flavor='slobrok-flavor'/></slobroks>" + "  </admin>" + "  <container version='1.0' id='container'>" + "     <nodes count='4' flavor='container-flavor'/>" + "  </container>" + "  <content version='1.0' id='foo'>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <controllers><nodes count='2' dedicated='true' flavor='controller-foo-flavor'/></controllers>" + "     <nodes count='5' flavor='content-foo-flavor'/>" + "  </content>" + "  <content version='1.0' id='bar'>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <controllers><nodes count='3' dedicated='true' flavor='controller-bar-flavor'/></controllers>" + "     <nodes count='6' flavor='content-bar-flavor'/>" + "  </content>" + "</services>";
    int totalHosts = 23;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts("logserver-flavor", 1);
    tester.addHosts("slobrok-flavor", 2);
    tester.addHosts("container-flavor", 4);
    tester.addHosts("controller-foo-flavor", 2);
    tester.addHosts("content-foo-flavor", 5);
    tester.addHosts("controller-bar-flavor", 3);
    tester.addHosts("content-bar-flavor", 6);
    // fails unless the right flavors+counts are requested
    VespaModel model = tester.createModel(services, true, 0);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(totalHosts));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 17 with VespaModel

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

the class ModelProvisioningTest method testClusterControllersWithGroupSize2.

@Test
public void testClusterControllersWithGroupSize2() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='4.0'/>" + "  <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>" + "     <nodes count='8' groups='4'/>" + "  </content>" + "</services>";
    int numberOfHosts = 18;
    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("We get the closest odd number", 3, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default08", clusterControllers.getContainers().get(2).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 18 with VespaModel

use of com.yahoo.vespa.model.VespaModel 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 19 with VespaModel

use of com.yahoo.vespa.model.VespaModel 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 20 with VespaModel

use of com.yahoo.vespa.model.VespaModel 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)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)153 Test (org.junit.Test)135 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)35 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)26 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)21 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)18 DeployState (com.yahoo.config.model.deploy.DeployState)18 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)15 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)14 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)13 Matchers.containsString (org.hamcrest.Matchers.containsString)12 File (java.io.File)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)6 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)5 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)5 HostResource (com.yahoo.vespa.model.HostResource)5