Search in sources :

Example 11 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster 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 12 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster 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 13 with ContainerCluster

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

the class ContainerModelBuilderTestBase method createModel.

public static void createModel(MockRoot root, DeployState deployState, Element... containerElems) throws SAXException, IOException {
    for (Element containerElem : containerElems) {
        ContainerModel model = new ContainerModelBuilder(false, ContainerModelBuilder.Networking.enable).build(deployState, null, root, containerElem);
        ContainerCluster cluster = model.getCluster();
        generateDefaultSearchChains(cluster);
    }
    root.freezeModelTopology();
}
Also used : Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 14 with ContainerCluster

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

the class RoutingBuilderTest method getContainer.

private Container getContainer(ApplicationPackage applicationPackage, String region, Element clusterElem) throws IOException, SAXException {
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).zone(new Zone(Environment.prod, RegionName.from(region))).build(true);
    root = new MockRoot("root", deployState);
    createModel(root, deployState, clusterElem);
    ContainerCluster cluster = getContainerCluster("default");
    return cluster.getContainers().get(0);
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster)

Example 15 with ContainerCluster

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

the class ClusterTest method testEndToEndOneNode.

@Test
public void testEndToEndOneNode() throws Exception {
    String services = "<?xml version='1.0' encoding='UTF-8' ?>" + "<services version='1.0'>" + "  <admin version='2.0'>" + "    <adminserver hostalias='node1'/>" + "  </admin>" + "   <jdisc id='default' version='1.0'>" + "     <search/>" + "     <nodes>" + "       <node hostalias='node1'/>" + "     </nodes>" + "   </jdisc>" + "   <content id='storage' version='1.0'>" + "     <redundancy>2</redundancy>" + "     <group>" + "       <node distribution-key='0' hostalias='node1'/>" + "       <node distribution-key='1' hostalias='node1'/>" + "     </group>" + "     <tuning>" + "       <cluster-controller>" + "         <transition-time>0</transition-time>" + "       </cluster-controller>" + "     </tuning>" + "     <documents>" + "       <document mode='store-only' type='type1'/>" + "     </documents>" + "     <engine>" + "       <proton/>" + "     </engine>" + "   </content>" + " </services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1");
    VespaModel model = (new VespaModelCreatorWithMockPkg(null, services, sds)).create();
    assertEquals(1, model.getContentClusters().get("storage").getDocumentDefinitions().size());
    ContainerCluster cluster = model.getAdmin().getClusterControllers();
    assertEquals(1, cluster.getContainers().size());
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test)

Aggregations

ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)42 Test (org.junit.Test)28 VespaModel (com.yahoo.vespa.model.VespaModel)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)11 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)10 Element (org.w3c.dom.Element)6 Component (com.yahoo.vespa.model.container.component.Component)4 ComponentId (com.yahoo.component.ComponentId)3 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 DeployState (com.yahoo.config.model.deploy.DeployState)2 Container (com.yahoo.vespa.model.container.Container)2 ContainerDocproc (com.yahoo.vespa.model.container.docproc.ContainerDocproc)2 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 Zone (com.yahoo.config.provision.Zone)1