Search in sources :

Example 36 with VespaModelTester

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

the class ModelProvisioningTest method test2ContentNodesProduces1ClusterController.

@Test
public void test2ContentNodesProduces1ClusterController() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "  </content>" + "</services>";
    int numberOfHosts = 2;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(1, clusterControllers.getContainers().size());
}
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 37 with VespaModelTester

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

the class ModelProvisioningTest method testNoNodeTagMeans1Node.

@Test
public void testNoNodeTagMeans1Node() {
    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.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().countNodes());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 38 with VespaModelTester

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

the class ModelProvisioningTest method testClusterControllersCanSupplementWithAllContainerClusters.

@Test
public void testClusterControllersCanSupplementWithAllContainerClusters() throws ParseException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <admin version='4.0'/>" + "  <container version='1.0' id='foo1'>" + "     <nodes count='2'/>" + "  </container>" + "  <container version='1.0' id='foo2'>" + "     <nodes count='1'/>" + "  </container>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <controllers><nodes dedicated='false' count='5'/></controllers>" + "     <nodes count='2'/>" + "  </content>" + "</services>";
    int numberOfHosts = 5;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    // TODO: Expected 5 with this feature reactivated
    assertEquals(1, clusterControllers.getContainers().size());
}
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