use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ClusterTest method testExplicitDistributionBits.
@Test
public void testExplicitDistributionBits() {
ContentCluster cluster = parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + " <tuning>\n" + " <distribution type=\"strict\"/>\n" + " </tuning>\n" + "</content>");
assertDistributionBitsInConfig(cluster, 8);
cluster = parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <engine>" + " <vds/>" + " </engine>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + " <tuning>\n" + " <distribution type=\"loose\"/>\n" + " </tuning>\n" + "</content>");
assertDistributionBitsInConfig(cluster, 8);
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ClusterTest method testMetrics.
@Test
public void testMetrics() {
MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
ContentCluster cluster = parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + "</content>");
cluster.getConfig(builder);
MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
assertEquals(6, config.consumer().size());
assertEquals("status", config.consumer(0).name());
assertEquals("*", config.consumer(0).addedmetrics(0));
assertEquals("partofsum", config.consumer(0).removedtags(0));
assertEquals("log", config.consumer(1).name());
assertEquals("logdefault", config.consumer(1).tags().get(0));
assertEquals("loadtype", config.consumer(1).removedtags(0));
assertEquals("yamas", config.consumer(2).name());
assertEquals("yamasdefault", config.consumer(2).tags().get(0));
assertEquals("loadtype", config.consumer(2).removedtags(0));
assertEquals("health", config.consumer(3).name());
assertEquals("statereporter", config.consumer(5).name());
assertEquals("*", config.consumer(5).addedmetrics(0));
assertEquals("thread", config.consumer(5).removedtags(0));
assertEquals("disk", config.consumer(5).tags(0));
cluster.getStorageNodes().getConfig(builder);
config = new MetricsmanagerConfig(builder);
assertEquals(6, config.consumer().size());
assertEquals("fleetcontroller", config.consumer(4).name());
assertEquals(3, config.consumer(4).addedmetrics().size());
assertEquals("vds.datastored.alldisks.docs", config.consumer(4).addedmetrics(0));
assertEquals("vds.datastored.alldisks.bytes", config.consumer(4).addedmetrics(1));
assertEquals("vds.datastored.alldisks.buckets", config.consumer(4).addedmetrics(2));
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ClusterTest method createWithZone.
private ContentCluster createWithZone(String clusterXml, Zone zone) throws Exception {
DeployState.Builder deployStateBuilder = new DeployState.Builder().zone(zone).properties(new DeployProperties.Builder().hostedVespa(true).build());
List<String> searchDefinitions = SearchDefinitionBuilder.createSearchDefinitions("test");
MockRoot root = ContentClusterUtils.createMockRoot(searchDefinitions, deployStateBuilder);
ContentCluster cluster = ContentClusterUtils.createCluster(clusterXml, root);
root.freezeModelTopology();
cluster.validate();
return cluster;
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ClusterTest method requireThatPreShutdownCommandIsSet.
@Test
public void requireThatPreShutdownCommandIsSet() {
ContentCluster cluster = parse("<content version=\"1.0\" id=\"storage\">" + " <documents/>" + " <engine>" + " <proton>" + " <flush-on-shutdown>true</flush-on-shutdown>" + " </proton>" + " </engine>" + " <group>" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + " </group>" + "</content>");
assertThat(cluster.getSearch().getSearchNodes().size(), is(1));
assertTrue(cluster.getSearch().getSearchNodes().get(0).getPreShutdownCommand().isPresent());
cluster = parse("<content version=\"1.0\" id=\"storage\">" + " <documents/>" + " <engine>" + " <proton>" + " <flush-on-shutdown> \n " + " true </flush-on-shutdown>" + " </proton>" + " </engine>" + " <group>" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + " </group>" + "</content>");
assertThat(cluster.getSearch().getSearchNodes().size(), is(1));
assertTrue(cluster.getSearch().getSearchNodes().get(0).getPreShutdownCommand().isPresent());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ClusterTest method testAlternativeNodeSyntax.
@Test
public void testAlternativeNodeSyntax() {
ContentCluster cluster = parse("<content version=\"1.0\" id=\"test\">\n" + " <documents/>" + " <engine>" + " <proton/>" + " </engine>" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + " </nodes>\n" + "</content>");
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
cluster.getConfig(builder);
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals("invalid", config.group(0).name());
assertEquals("invalid", config.group(0).index());
assertEquals(2, config.group(0).nodes().size());
}
Aggregations