Search in sources :

Example 21 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class ClusterTest method testConfiguredMetrics.

@Test
public void testConfiguredMetrics() throws Exception {
    String xml = "" + "<services>" + "<content version=\"1.0\" id=\"storage\">\n" + "  <redundancy>1</redundancy>\n" + "  <documents>" + "   <document type=\"type1\" mode='index'/>\n" + "   <document type=\"type2\" mode='index'/>\n" + "  </documents>" + "  <group>\n" + "    <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + "  </group>\n" + "</content>" + "<admin version=\"2.0\">" + "  <logserver hostalias=\"node0\"/>" + "  <adminserver hostalias=\"node0\"/>" + "  <metric-consumers>" + "    <consumer name=\"foobar\">" + "      <metric name=\"storage.foo.bar\"/>" + "    </consumer>" + "    <consumer name=\"log\">" + "      <metric name=\"extralogmetric\"/>" + "      <metric name=\"extralogmetric3\"/>" + "    </consumer>" + "    <consumer name=\"fleetcontroller\">" + "      <metric name=\"extraextra\"/>" + "    </consumer>" + "  </metric-consumers>" + "</admin>" + "</services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
    VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create();
    {
        MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
        model.getConfig(builder, "storage/storage/0");
        MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
        assertEquals("[storage.foo.bar]", getConsumer("foobar", config).addedmetrics().toString());
        String expected = "[extralogmetric\n" + "extralogmetric3\n" + "vds.filestor.alldisks.allthreads.put.sum\n" + "vds.filestor.alldisks.allthreads.get.sum\n" + "vds.filestor.alldisks.allthreads.remove.sum\n" + "vds.filestor.alldisks.allthreads.update.sum\n" + "vds.datastored.alldisks.docs\n" + "vds.datastored.alldisks.bytes\n" + "vds.filestor.alldisks.queuesize\n" + "vds.filestor.alldisks.averagequeuewait.sum\n" + "vds.visitor.cv_queuewaittime\n" + "vds.visitor.allthreads.averagequeuewait\n" + "vds.visitor.allthreads.averagevisitorlifetime\n" + "vds.visitor.allthreads.created.sum]";
        String actual = getConsumer("log", config).addedmetrics().toString().replaceAll(", ", "\n");
        assertEquals(expected, actual);
        assertEquals("[logdefault]", getConsumer("log", config).tags().toString());
        expected = "[extraextra\n" + "vds.datastored.alldisks.docs\n" + "vds.datastored.alldisks.bytes\n" + "vds.datastored.alldisks.buckets]";
        actual = getConsumer("fleetcontroller", config).addedmetrics().toString().replaceAll(", ", "\n");
        assertEquals(expected, actual);
    }
    {
        MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder();
        model.getConfig(builder, "storage/distributor/0");
        MetricsmanagerConfig config = new MetricsmanagerConfig(builder);
        assertEquals("[storage.foo.bar]", getConsumer("foobar", config).addedmetrics().toString());
        assertEquals("[extralogmetric, extralogmetric3, vds.distributor.docsstored, vds.distributor.bytesstored, vds.idealstate.delete_bucket.done_ok, vds.idealstate.merge_bucket.done_ok, vds.idealstate.split_bucket.done_ok, vds.idealstate.join_bucket.done_ok, vds.idealstate.buckets_rechecking]", getConsumer("log", config).addedmetrics().toString());
        assertEquals("[logdefault]", getConsumer("log", config).tags().toString());
        assertEquals("[extraextra]", getConsumer("fleetcontroller", config).addedmetrics().toString());
    }
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) MetricsmanagerConfig(com.yahoo.metrics.MetricsmanagerConfig) Test(org.junit.Test)

Example 22 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class ClusterTest method testEndToEnd.

@Test
public void testEndToEnd() throws Exception {
    String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + "  <admin version=\"2.0\">\n" + "    <adminserver hostalias=\"configserver\" />\n" + "    <logserver hostalias=\"logserver\" />\n" + "    <slobroks>\n" + "      <slobrok hostalias=\"configserver\" />\n" + "      <slobrok hostalias=\"logserver\" />\n" + "    </slobroks>\n" + "    <cluster-controllers>\n" + "      <cluster-controller hostalias=\"configserver\"/>" + "      <cluster-controller hostalias=\"configserver2\"/>" + "      <cluster-controller hostalias=\"configserver3\"/>" + "    </cluster-controllers>\n" + "  </admin>\n" + "  <content version='1.0' id='bar'>" + "     <redundancy>1</redundancy>\n" + "     <documents>" + "       <document type=\"type1\" mode=\"index\"/>\n" + "       <document type=\"type2\" mode=\"index\"/>\n" + "     </documents>\n" + "     <group>" + "       <node hostalias='node0' distribution-key='0' />" + "     </group>" + "    <tuning>" + "      <cluster-controller>\n" + "        <init-progress-time>34567</init-progress-time>" + "      </cluster-controller>" + "    </tuning>" + "   </content>" + "\n" + "</services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
    VespaModel model = (new VespaModelCreatorWithMockPkg(null, xml, sds)).create();
    assertEquals(2, model.getContentClusters().get("bar").getDocumentDefinitions().size());
    ContainerCluster cluster = model.getAdmin().getClusterControllers();
    assertEquals(3, cluster.getContainers().size());
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Test(org.junit.Test)

Example 23 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class ClusterTest method reserved_document_name_throws_exception.

@Test
public void reserved_document_name_throws_exception() {
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("The following document types conflict with reserved keyword names: 'true'.");
    String xml = "<content version=\"1.0\" id=\"storage\">" + "  <redundancy>1</redundancy>" + "  <documents>" + "    <document type=\"true\" mode=\"index\"/>" + "  </documents>" + "  <group>" + "    <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + "  </group>" + "</content>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("true");
    new VespaModelCreatorWithMockPkg(null, xml, sds).create();
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) Test(org.junit.Test)

Example 24 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class AdminTestCase method disableFiledistributorService.

@Test
public void disableFiledistributorService() throws Exception {
    String hosts = "<hosts>" + "  <host name=\"localhost\">" + "    <alias>node0</alias>" + "  </host>" + "</hosts>";
    String services = "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "    <filedistribution>" + "      <disableFiledistributor>true</disableFiledistributor>" + "    </filedistribution>" + "  </admin>" + "</services>";
    VespaModel vespaModel = new VespaModelCreatorWithMockPkg(hosts, services).create();
    String localhost = HostName.getLocalhost();
    String localhostConfigId = "hosts/" + localhost;
    // Verify services in the sentinel config
    SentinelConfig.Builder b = new SentinelConfig.Builder();
    vespaModel.getConfig(b, localhostConfigId);
    SentinelConfig sentinelConfig = new SentinelConfig(b);
    assertThat(sentinelConfig.service().size(), is(3));
    assertThat(sentinelConfig.service(0).name(), is("logserver"));
    assertThat(sentinelConfig.service(1).name(), is("slobrok"));
    assertThat(sentinelConfig.service(2).name(), is("logd"));
// No filedistributor service
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 25 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class AdminTestCase method testLogForwarding.

@Test
public void testLogForwarding() throws Exception {
    String hosts = "<hosts>" + "  <host name=\"myhost0\">" + "    <alias>node0</alias>" + "  </host>" + "</hosts>";
    String services = "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "    <logforwarding>" + "      <splunk deployment-server='foo:123' client-name='foocli'/>" + "    </logforwarding>" + "  </admin>" + "</services>";
    VespaModel vespaModel = new VespaModelCreatorWithMockPkg(hosts, services).create();
    Set<String> configIds = vespaModel.getConfigIds();
    // 1 logforwarder on each host
    assertTrue(configIds.toString(), configIds.contains("hosts/myhost0/logforwarder"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)31 VespaModel (com.yahoo.vespa.model.VespaModel)26 Test (org.junit.Test)22 DeployState (com.yahoo.config.model.deploy.DeployState)5 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)4 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)4 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)3 ConfigPayloadBuilder (com.yahoo.vespa.config.ConfigPayloadBuilder)3 AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)3 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)3 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)3 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)2