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());
}
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());
}
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();
}
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);
}
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());
}
Aggregations