Search in sources :

Example 26 with VespaModelTester

use of com.yahoo.vespa.model.test.VespaModelTester 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 27 with VespaModelTester

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

the class ModelProvisioningTest method testRequiringMoreNodesThanAreAvailable.

@Test(expected = IllegalArgumentException.class)
public void testRequiringMoreNodesThanAreAvailable() throws ParseException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <content version='1.0' id='bar'>" + "     <redundancy>1</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='3' required='true'/>" + "  </content>" + "</services>";
    int numberOfHosts = 2;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    tester.createModel(services, false);
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) Test(org.junit.Test)

Example 28 with VespaModelTester

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

Example 29 with VespaModelTester

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

the class ModelProvisioningTest method testUsingHostaliasWithProvisioner.

@Test
public void testUsingHostaliasWithProvisioner() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "<admin version='2.0'>" + "  <adminserver hostalias='node1'/>\n" + "</admin>\n" + "<jdisc id='mydisc' version='1.0'>" + "  <handler id='myHandler'>" + "    <component id='injected' />" + "  </handler>" + "  <nodes>" + "    <node hostalias='node1'/>" + "  </nodes>" + "</jdisc>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(1);
    VespaModel model = tester.createModel(services, true);
    assertEquals(1, model.getRoot().getHostSystem().getHosts().size());
    assertEquals(1, model.getAdmin().getSlobroks().size());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 30 with VespaModelTester

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

the class ModelProvisioningTest method testClusterControllersAreNotPlacedOnRetiredNodes.

@Test
public void testClusterControllersAreNotPlacedOnRetiredNodes() {
    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='9' groups='3'/>" + "  </content>" + "</services>";
    int numberOfHosts = 19;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true, "default09", "default06", "default03");
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check content clusters
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(3, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("Skipping retired default09", "default01", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("Skipping retired default03", "default04", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("Skipping retired default06", "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)

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