use of com.yahoo.vespa.model.VespaModel 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());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterControllerTestCase method testUnconfigured.
@Test
public void testUnconfigured() 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" + " </admin>\n" + " <content version='1.0' id='bar'>" + " <redundancy>1</redundancy>\n" + " <documents>" + " <document type=\"type1\" mode=\"store-only\"/>\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>";
VespaModel model = createVespaModel(xml);
assertTrue(model.getService("admin/cluster-controllers/0").isPresent());
assertTrue(existsHostsWithClusterControllerConfigId(model));
assertGroupSize(model, "admin/cluster-controllers/0/components/clustercontroller-bar-configurer", 1);
assertThat(model.getAdmin().getClusterControllers().getContainers().size(), is(1));
FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
model.getConfig(builder, "admin/cluster-controllers/0/components/clustercontroller-bar-configurer");
FleetcontrollerConfig cfg = new FleetcontrollerConfig(builder);
assertThat(cfg.index(), is(0));
assertThat(cfg.fleet_controller_count(), is(1));
assertThat(cfg.init_progress_time(), is(34567000));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterControllerTestCase method createVespaModel.
private VespaModel createVespaModel(String servicesXml) throws IOException, SAXException {
VespaModel model = new VespaModel(new MockApplicationPackage.Builder().withServices(servicesXml).withSearchDefinitions(sds).build());
SimpleApplicationValidator.checkServices(new StringReader(servicesXml), new Version(6));
return model;
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class DeploymentFileValidatorTest method testDeploymentWithNonExistentGlobalId.
@Test
public void testDeploymentWithNonExistentGlobalId() throws IOException, SAXException {
final String simpleHosts = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<hosts> " + "<host name=\"localhost\">" + "<alias>node0</alias>" + "</host>" + "</hosts>";
final String services = "<services version='1.0'>" + " <admin version='2.0'>" + " <adminserver hostalias='node0' />" + " </admin>" + " <jdisc id='default' version='1.0'>" + " <search/>" + " <nodes>" + " <node hostalias='node0'/>" + " </nodes>" + " </jdisc>" + "</services>";
final String deploymentSpec = "<?xml version='1.0' encoding='UTF-8'?>" + "<deployment version='1.0'>" + " <test />" + " <prod global-service-id='non-existing'>" + " <region active='true'>us-east</region>" + " </prod>" + "</deployment>";
ApplicationPackage app = new MockApplicationPackage.Builder().withHosts(simpleHosts).withServices(services).withDeploymentSpec(deploymentSpec).build();
DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
try {
final DeployState deployState = builder.build(true);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new DeploymentFileValidator().validate(model, deployState);
fail("Did not get expected exception");
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("specified in deployment.xml does not match any container cluster id"));
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterSizeReductionValidatorTest method testSizeReductionValidation.
@Test
public void testSizeReductionValidation() throws IOException, SAXException {
ValidationTester tester = new ValidationTester(30);
VespaModel previous = tester.deploy(null, getServices(30), null).getFirst();
try {
tester.deploy(previous, getServices(14), null);
fail("Expected exception due to cluster size reduction");
} catch (IllegalArgumentException expected) {
assertEquals("cluster-size-reduction: Size reduction in 'default' is too large. Current size: 30, new size: 14. New size must be at least 50% of the current size", Exceptions.toMessageString(expected));
}
}
Aggregations