Search in sources :

Example 16 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class AdminTestCase method testContainerMetricsSnapshotInterval.

@Test
public void testContainerMetricsSnapshotInterval() throws Exception {
    VespaModel vespaModel = getVespaModel(TESTDIR + "metricconfig");
    ContainerCluster docprocCluster = vespaModel.getContainerClusters().get("cluster.music.indexing");
    HealthMonitorConfig.Builder builder = new HealthMonitorConfig.Builder();
    docprocCluster.getConfig(builder);
    HealthMonitorConfig docprocConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) docprocConfig.snapshot_interval());
    ContainerCluster qrCluster = vespaModel.getContainerClusters().get("container");
    builder = new HealthMonitorConfig.Builder();
    qrCluster.getConfig(builder);
    HealthMonitorConfig qrClusterConfig = new HealthMonitorConfig(builder);
    assertEquals(60, (int) qrClusterConfig.snapshot_interval());
    StatisticsComponent stat = null;
    for (Component component : qrCluster.getAllComponents()) {
        if (component.getClassId().getName().contains("com.yahoo.statistics.StatisticsImpl")) {
            stat = (StatisticsComponent) component;
            break;
        }
    }
    assertNotNull(stat);
    StatisticsConfig.Builder sb = new StatisticsConfig.Builder();
    stat.getConfig(sb);
    StatisticsConfig sc = new StatisticsConfig(sb);
    assertEquals(60, (int) sc.collectionintervalsec());
    assertEquals(60, (int) sc.loggingintervalsec());
}
Also used : StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) StatisticsConfig(com.yahoo.container.StatisticsConfig) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) HealthMonitorConfig(com.yahoo.container.jdisc.config.HealthMonitorConfig) StatisticsComponent(com.yahoo.vespa.model.container.component.StatisticsComponent) Component(com.yahoo.vespa.model.container.component.Component) Test(org.junit.Test)

Example 17 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class SearchBuilderTest method cluster_is_connected_to_search_clusters.

@Test
public void cluster_is_connected_to_search_clusters() throws Exception {
    String hosts = hostsXml();
    String services = "" + "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='mockhost'/>" + "  </admin>" + "  <jdisc version='1.0' id='container'>" + "      <search>" + "        <chain id='mychain' inherits='vespa'/>" + "      </search>" + "      <nodes>" + "        <node hostalias=\"mockhost\" />" + "      </nodes>" + "  </jdisc>" + contentXml() + "</services>";
    VespaModel model = getVespaModelWithMusic(hosts, services);
    ContainerCluster cluster = model.getContainerClusters().get("container");
    assertFalse(cluster.getSearchChains().localProviders().isEmpty());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 18 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class SearchBuilderTest method cluster_with_only_search_gets_qrserver_as_service_name.

// TODO: remove test when all containers are named 'container'
@Test
public void cluster_with_only_search_gets_qrserver_as_service_name() throws Exception {
    createClusterWithOnlyDefaultChains();
    ContainerCluster cluster = (ContainerCluster) root.getChildren().get("default");
    assertThat(cluster.getContainers().get(0).getServiceName(), is("qrserver"));
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 19 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class IndexingAndDocprocRoutingTest method assertIndexing.

private void assertIndexing(VespaModel model, DocprocClusterSpec... expectedDocprocClusters) {
    Map<String, ContainerCluster> docprocClusters = getDocprocClusters(model);
    assertThat(docprocClusters.size(), is(expectedDocprocClusters.length));
    for (DocprocClusterSpec expectedDocprocCluster : expectedDocprocClusters) {
        ContainerCluster docprocCluster = docprocClusters.get(expectedDocprocCluster.name);
        assertThat(docprocCluster, not(nullValue()));
        assertThat(docprocCluster.getName(), is(expectedDocprocCluster.name));
        ContainerDocproc containerDocproc = docprocCluster.getDocproc();
        assertThat(containerDocproc, not(nullValue()));
        List<DocprocChain> chains = containerDocproc.getChains().allChains().allComponents();
        assertThat(chains.size(), is(expectedDocprocCluster.chains.size()));
        List<String> actualDocprocChains = new ArrayList<>();
        for (DocprocChain chain : chains) {
            actualDocprocChains.add(chain.getServiceName());
        }
        List<String> expectedDocprocChainStrings = new ArrayList<>();
        for (DocprocChainSpec spec : expectedDocprocCluster.chains) {
            expectedDocprocChainStrings.add(spec.name);
        }
        assertThat(actualDocprocChains, hasItems(expectedDocprocChainStrings.toArray(new String[0])));
    }
}
Also used : DocprocChain(com.yahoo.vespa.model.container.docproc.DocprocChain) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerDocproc(com.yahoo.vespa.model.container.docproc.ContainerDocproc)

Example 20 with ContainerCluster

use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.

the class IndexedTest method requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey.

@Test
public void requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey() {
    VespaModel model = getIndexedVespaModel();
    ContainerCluster cluster = model.getContainerClusters().get("cluster.test.indexing");
    assertEquals("docproc/cluster.test.indexing/3", cluster.getContainers().get(0).getConfigId());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test)

Aggregations

ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)42 Test (org.junit.Test)28 VespaModel (com.yahoo.vespa.model.VespaModel)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)11 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)10 Element (org.w3c.dom.Element)6 Component (com.yahoo.vespa.model.container.component.Component)4 ComponentId (com.yahoo.component.ComponentId)3 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 DeployState (com.yahoo.config.model.deploy.DeployState)2 Container (com.yahoo.vespa.model.container.Container)2 ContainerDocproc (com.yahoo.vespa.model.container.docproc.ContainerDocproc)2 JettyHttpServer (com.yahoo.vespa.model.container.http.JettyHttpServer)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ConfigModel (com.yahoo.config.model.ConfigModel)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 Zone (com.yahoo.config.provision.Zone)1