use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContainerRestartValidatorTest method validator_returns_empty_list_for_containers_with_restart_on_deploy_disabled.
@Test
public void validator_returns_empty_list_for_containers_with_restart_on_deploy_disabled() {
VespaModel current = createModel(false);
VespaModel next = createModel(false);
List<ConfigChangeAction> result = validateModel(current, next);
assertTrue(result.isEmpty());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContainerRestartValidatorTest method validator_returns_action_for_containers_with_restart_on_deploy_enabled.
@Test
public void validator_returns_action_for_containers_with_restart_on_deploy_enabled() {
VespaModel current = createModel(true);
VespaModel next = createModel(true);
List<ConfigChangeAction> result = validateModel(current, next);
assertEquals(2, result.size());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContentBuilderTest method handleIndexedOnlyWithoutPersistence.
@Test
public void handleIndexedOnlyWithoutPersistence() throws Exception {
VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
ContentCluster c = CollectionUtil.first(m.getContentClusters().values());
ContentSearchCluster s = c.getSearch();
assertTrue(s.hasIndexedCluster());
assertEquals(1, s.getClusters().size());
assertNotNull(s.getIndexed());
assertEquals("clu", s.getIndexed().getClusterName());
assertEquals(7.3, s.getIndexed().getQueryTimeout(), 0.0);
assertTrue(c.getPersistence() instanceof ProtonEngine.Factory);
assertEquals(1, c.getStorageNodes().getChildren().size());
assertEquals("clu", c.getConfigId());
// assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId()); // This is how it should look like in an ideal world.
// Due to reuse.
assertEquals("clu/storage/0", c.getRootGroup().getNodes().get(0).getConfigId());
assertEquals(1, c.getRoot().getHostSystem().getHosts().size());
HostResource h = c.getRoot().getHostSystem().getHost("mockhost");
String[] expectedServices = { "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "topleveldispatch", "transactionlogserver" };
// TODO assertServices(h, expectedServices);
assertEquals("clu/storage/0", h.getService("storagenode").getConfigId());
assertEquals("clu/search/cluster.clu/0", h.getService("searchnode").getConfigId());
assertEquals("clu/distributor/0", h.getService("distributor").getConfigId());
assertEquals("clu/search/cluster.clu/tlds/qrc.0.tld.0", h.getService("topleveldispatch").getConfigId());
// assertEquals("tcp/node0:19104", h.getService("topleveldispatch").getConfig("partitions", "").innerArray("dataset").value("0").innerArray("engine").value("0").getString("name_and_port"));
PartitionsConfig partitionsConfig = new PartitionsConfig((PartitionsConfig.Builder) m.getConfig(new PartitionsConfig.Builder(), "clu/search/cluster.clu/tlds/qrc.0.tld.0"));
assertTrue(partitionsConfig.dataset(0).engine(0).name_and_port().startsWith("tcp/node0:191"));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ContentBuilderTest method createContentWithBooksToo.
private ContentCluster createContentWithBooksToo(String xml) throws Exception {
String combined = "" + "<services>" + " <admin version='2.0'>" + " <adminserver hostalias='mockhost'/>" + " </admin>" + xml + "</services>";
VespaModel m = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder().withHosts(getHosts()).withServices(combined).withSearchDefinitions(Arrays.asList(MockApplicationPackage.MUSIC_SEARCHDEFINITION, MockApplicationPackage.BOOK_SEARCHDEFINITION)).build()).create();
return m.getContentClusters().isEmpty() ? null : m.getContentClusters().values().iterator().next();
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class VespaDomBuilderTest method testHostSystem.
@Test
public void testHostSystem() {
VespaModel model = createModel(hosts, services);
HostSystem hostSystem = model.getHostSystem();
assertThat(hostSystem.getHosts().size(), is(1));
HostResource host = hostSystem.getHosts().get(0);
assertThat(host, is(hostSystem.getHostByHostname(host.getHostname())));
assertNotNull(hostSystem.getHost("node1"));
assertThat(hostSystem.toString(), is("host '" + host.getHostname() + "'"));
}
Aggregations