use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.
the class ContentBuilderTest method handleStreamingOnlyWithoutPersistence.
@Test
public void handleStreamingOnlyWithoutPersistence() throws Exception {
final String musicClusterId = "music-cluster-id";
ContentCluster cluster = createContent("<content version='1.0' id='" + musicClusterId + "'>" + " <redundancy>3</redundancy>" + " <documents>" + " <document type='music' mode='streaming'/>" + " </documents>" + " <engine>" + " <vds/>" + " </engine>" + " <group>" + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + " </group>" + "</content>");
ContentSearchCluster s;
s = cluster.getSearch();
assertFalse(s.hasIndexedCluster());
assertEquals(1, s.getClusters().size());
assertNull(s.getIndexed());
AbstractSearchCluster sc = s.getClusters().get(musicClusterId + ".music");
assertEquals(musicClusterId + ".music", sc.getClusterName());
assertEquals(musicClusterId, ((StreamingSearchCluster) sc).getStorageRouteSpec());
assertTrue(cluster.getPersistence() instanceof VDSEngine.Factory);
assertEquals(1, cluster.getStorageNodes().getChildren().size());
assertEquals(musicClusterId, cluster.getConfigId());
// assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId());
// Due to reuse.
assertEquals(musicClusterId + "/storage/0", cluster.getRootGroup().getNodes().get(0).getConfigId());
assertEquals(1, cluster.getRoot().getHostSystem().getHosts().size());
HostResource h = cluster.getRoot().getHostSystem().getHost("mockhost");
String[] expectedServices = { "logd", "configproxy", "config-sentinel", "configserver", "logserver", "slobrok", "container-clustercontroller", "storagenode", "distributor" };
assertServices(h, expectedServices);
assertEquals(musicClusterId + "/storage/0", h.getService("storagenode").getConfigId());
/* Not yet
assertNotNull(h.getService("qrserver"));
assertNotNull(h.getService("topleveldisptach"));
assertNotNull(h.getService("docproc"));
*/
}
use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.
the class ContainerClusterTest method addClusterController.
private static void addClusterController(ContainerCluster cluster, String hostName) {
Container container = new ClusterControllerContainer(cluster, 1, false);
container.setHostResource(new HostResource(new Host(null, hostName)));
container.initService();
cluster.addContainer(container);
}
use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.
the class SearchNodeTest method requireThatPreShutdownCommandIsEmptyWhenNotActivated.
@Test
public void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false);
node.setHostResource(new HostResource(new Host(node, "mynbode")));
node.initService();
assertFalse(node.getPreShutdownCommand().isPresent());
}
use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.
the class SearchNodeTest method requireThatPreShutdownCommandUsesPrepareRestartWhenActivated.
@Test
public void requireThatPreShutdownCommandUsesPrepareRestartWhenActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode2", 4, new NodeSpec(7, 5), true);
node.setHostResource(new HostResource(new Host(node, "mynbode2")));
node.initService();
assertTrue(node.getPreShutdownCommand().isPresent());
Assert.assertThat(node.getPreShutdownCommand().get(), CoreMatchers.containsString("vespa-proton-cmd " + node.getRpcPort() + " prepareRestart"));
}
use of com.yahoo.vespa.model.HostResource in project vespa by vespa-engine.
the class ModelAmendingTestCase method testModelAmending.
@Test
public void testModelAmending() throws IOException, SAXException {
ConfigModelRegistry amendingModelRepo = MapConfigModelRegistry.createFromList(new AdminModelAmenderBuilder(), new ContainerModelAmenderBuilder(), new ContentModelAmenderBuilder());
String services = "<services version='1.0'>" + " <admin version='4.0'/>" + " <jdisc id='test1' version='1.0'>" + " <search/>" + " <nodes count='2'/>" + " </jdisc>" + " <jdisc id='test2' version='1.0'>" + " <http><server id='server1' port='19110'/></http>" + " <document-api/>" + " <nodes count='2'/>" + " </jdisc>" + " <content id='test3' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents>" + " <document mode='index' type='type1'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + " <content id='test4' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents>" + " <document mode='index' type='type1'/>" + " </documents>" + " <nodes count='3'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester(amendingModelRepo);
tester.addHosts(10);
VespaModel model = tester.createModel(services);
// Check that all hosts are amended
for (HostResource host : model.getAdmin().getHostSystem().getHosts()) {
assertFalse(host + " is amended", host.getHost().getChildrenByTypeRecursive(AmendedService.class).isEmpty());
}
// Check that jdisc clusters are amended
assertEquals(2, model.getContainerClusters().size());
assertNotNull(model.getContainerClusters().get("test1").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
assertNotNull(model.getContainerClusters().get("test2").getComponentsMap().get(new ComponentId("com.yahoo.MyAmendedComponent")));
}
Aggregations