Search in sources :

Example 81 with VespaModel

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

the class ModelProvisioningTest method testNoNodeTagMeans1NodeNonHosted.

@Test
public void testNoNodeTagMeans1NodeNonHosted() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <jdisc id='foo' version='1.0'>" + "    <search/>" + "    <document-api/>" + "  </jdisc>" + "  <content version='1.0' id='bar'>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "  </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.setHosted(false);
    tester.addHosts(1);
    VespaModel model = tester.createModel(services, true);
    assertEquals(1, model.getRoot().getHostSystem().getHosts().size());
    assertEquals(1, model.getAdmin().getSlobroks().size());
    assertEquals(1, model.getContainerClusters().get("foo").getContainers().size());
    assertEquals(1, model.getContentClusters().get("bar").getRootGroup().recursiveGetNodes().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 82 with VespaModel

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

the class ModelProvisioningTest method testCombinedClusterWithJvmArgs.

@Test
public void testCombinedClusterWithJvmArgs() {
    String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + "  <container version='1.0' id='container1'>" + "     <document-processing/>" + "     <nodes of='content1' jvmargs='testarg'/>" + "  </container>" + "  <content version='1.0' id='content1'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "   </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(2);
    VespaModel model = tester.createModel(xmlWithNodes, true);
    assertEquals("Nodes in content1", 2, model.getContentClusters().get("content1").getRootGroup().getNodes().size());
    assertEquals("Nodes in container1", 2, model.getContainerClusters().get("container1").getContainers().size());
    for (Container container : model.getContainerClusters().get("container1").getContainers()) assertTrue(container.getJvmArgs().contains("testarg"));
}
Also used : Container(com.yahoo.vespa.model.container.Container) VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 83 with VespaModel

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

the class ModelProvisioningTest method testMultipleCombinedClusters.

@Test
public void testMultipleCombinedClusters() {
    String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + "  <container version='1.0' id='container1'>" + "     <nodes of='content1'/>" + "  </container>" + "  <container version='1.0' id='container2'>" + "     <nodes of='content2'/>" + "  </container>" + "  <content version='1.0' id='content1'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "   </content>" + "  <content version='1.0' id='content2'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='3'/>" + "   </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(5);
    VespaModel model = tester.createModel(xmlWithNodes, true);
    assertEquals("Nodes in content1", 2, model.getContentClusters().get("content1").getRootGroup().getNodes().size());
    assertEquals("Nodes in container1", 2, model.getContainerClusters().get("container1").getContainers().size());
    assertEquals("Nodes in content2", 3, model.getContentClusters().get("content2").getRootGroup().getNodes().size());
    assertEquals("Nodes in container2", 3, model.getContainerClusters().get("container2").getContainers().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 84 with VespaModel

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

the class ModelProvisioningTest method testSlobroksClustersAreExpandedToIncludeRetiredNodesWhenRetiredComesLast.

@Test
public void testSlobroksClustersAreExpandedToIncludeRetiredNodesWhenRetiredComesLast() throws ParseException {
    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>" + "</services>";
    int numberOfHosts = 10;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true, "default09", "default08");
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check slobroks clusters
    assertEquals("Includes retired node", 3 + 2, model.getAdmin().getSlobroks().size());
    assertEquals("default01", model.getAdmin().getSlobroks().get(0).getHostName());
    assertEquals("default02", model.getAdmin().getSlobroks().get(1).getHostName());
    assertEquals("default10", model.getAdmin().getSlobroks().get(2).getHostName());
    assertEquals("Included in addition because it is retired", "default08", model.getAdmin().getSlobroks().get(3).getHostName());
    assertEquals("Included in addition because it is retired", "default09", model.getAdmin().getSlobroks().get(4).getHostName());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 85 with VespaModel

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

the class ModelProvisioningTest method testSlobroksAreSpreadOverAllContainerClusters.

@Test
public void testSlobroksAreSpreadOverAllContainerClusters() {
    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>" + "  <container version='1.0' id='bar'>" + "     <nodes count='3'/>" + "  </container>" + "</services>";
    int numberOfHosts = 13;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true, "default12", "default03", "default02");
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check slobroks clusters
    // ... from cluster default
    assertEquals("Includes retired node", 3 + 3, model.getAdmin().getSlobroks().size());
    assertEquals("default04", model.getAdmin().getSlobroks().get(0).getHostName());
    assertEquals("default13", model.getAdmin().getSlobroks().get(1).getHostName());
    assertEquals("Included in addition because it is retired", "default12", model.getAdmin().getSlobroks().get(2).getHostName());
    // ... from cluster bar
    assertEquals("default01", model.getAdmin().getSlobroks().get(3).getHostName());
    assertEquals("Included in addition because it is retired", "default02", model.getAdmin().getSlobroks().get(4).getHostName());
    assertEquals("Included in addition because it is retired", "default03", model.getAdmin().getSlobroks().get(5).getHostName());
}
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