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