Search in sources :

Example 61 with ContentCluster

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);
}
Also used : ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 62 with ContentCluster

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));
}
Also used : SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) MetricsmanagerConfig(com.yahoo.metrics.MetricsmanagerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 63 with ContentCluster

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;
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 64 with ContentCluster

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());
}
Also used : ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 65 with ContentCluster

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());
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)83 Test (org.junit.Test)70 VespaModel (com.yahoo.vespa.model.VespaModel)22 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)20 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)18 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)15 MockRoot (com.yahoo.config.model.test.MockRoot)7 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)7 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)6 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)5 HostResource (com.yahoo.vespa.model.HostResource)5 SearchNode (com.yahoo.vespa.model.search.SearchNode)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)4 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)3 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)2