use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.
the class ModelProvisioningTest method test2ContentNodesOn2ClustersWithContainerClusterProducesMixedClusterControllerCluster.
// TODO: unignore when feature is enabled again
@Ignore
@Test
public void test2ContentNodesOn2ClustersWithContainerClusterProducesMixedClusterControllerCluster() throws ParseException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <container version='1.0' id='container'>" + " <nodes count='3' flavor='container-node'/>" + " </container>" + " <content version='1.0' id='content1'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2' flavor='content1-node'/>" + " </content>" + " <content version='1.0' id='content2'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2' flavor='content2-node'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
// use different flavors to make the test clearer
tester.addHosts("container-node", 3);
tester.addHosts("content1-node", 2);
tester.addHosts("content2-node", 2);
VespaModel model = tester.createModel(services, true);
ContentCluster cluster1 = model.getContentClusters().get("content1");
ContainerCluster clusterControllers1 = cluster1.getClusterControllers();
assertEquals(1, clusterControllers1.getContainers().size());
assertEquals("content1-node0", clusterControllers1.getContainers().get(0).getHostName());
assertEquals("content1-node1", clusterControllers1.getContainers().get(1).getHostName());
assertEquals("container-node0", clusterControllers1.getContainers().get(2).getHostName());
ContentCluster cluster2 = model.getContentClusters().get("content2");
ContainerCluster clusterControllers2 = cluster2.getClusterControllers();
assertEquals(3, clusterControllers2.getContainers().size());
assertEquals("content2-node0", clusterControllers2.getContainers().get(0).getHostName());
assertEquals("content2-node1", clusterControllers2.getContainers().get(1).getHostName());
assertEquals("We do not pick the container used to supplement another cluster", "container-node1", clusterControllers2.getContainers().get(2).getHostName());
}
use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.
the class ModelProvisioningTest method test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster.
@Test
public void test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster() throws ParseException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <container version='1.0' id='foo'>" + " <nodes count='3'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(5);
VespaModel model = tester.createModel(services, true);
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
// TODO: Expected 3 with this feature reactivated
assertEquals(1, clusterControllers.getContainers().size());
}
use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.
the class ModelProvisioningTest method testInvalidCombinedClusterReference.
@Test
public void testInvalidCombinedClusterReference() {
String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + " <container version='1.0' id='container1'>" + " <nodes of='container2'/><!-- invalid; only content clusters can be referenced -->" + " </container>" + " <container version='1.0' id='container2'>" + " <nodes count='2'/>" + " </container>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(2);
try {
tester.createModel(xmlWithNodes, true);
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("container cluster 'container1' references service 'container2', but that is not a content service", e.getMessage());
}
}
use of com.yahoo.vespa.model.test.VespaModelTester in project vespa by vespa-engine.
the class ModelProvisioningTest method testRequestingSpecificFlavors.
@Test
public void testRequestingSpecificFlavors() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'>" + " <logservers><nodes count='1' dedicated='true' flavor='logserver-flavor'/></logservers>" + " <slobroks><nodes count='2' dedicated='true' flavor='slobrok-flavor'/></slobroks>" + " </admin>" + " <container version='1.0' id='container'>" + " <nodes count='4' flavor='container-flavor'/>" + " </container>" + " <content version='1.0' id='foo'>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes count='2' dedicated='true' flavor='controller-foo-flavor'/></controllers>" + " <nodes count='5' flavor='content-foo-flavor'/>" + " </content>" + " <content version='1.0' id='bar'>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes count='3' dedicated='true' flavor='controller-bar-flavor'/></controllers>" + " <nodes count='6' flavor='content-bar-flavor'/>" + " </content>" + "</services>";
int totalHosts = 23;
VespaModelTester tester = new VespaModelTester();
tester.addHosts("logserver-flavor", 1);
tester.addHosts("slobrok-flavor", 2);
tester.addHosts("container-flavor", 4);
tester.addHosts("controller-foo-flavor", 2);
tester.addHosts("content-foo-flavor", 5);
tester.addHosts("controller-bar-flavor", 3);
tester.addHosts("content-bar-flavor", 6);
// fails unless the right flavors+counts are requested
VespaModel model = tester.createModel(services, true, 0);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(totalHosts));
}
use of com.yahoo.vespa.model.test.VespaModelTester 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());
}
Aggregations