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());
}
}
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());
}
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();
}
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
}
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"));
}
Aggregations