use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class ClusterTest method testEndToEndOneNode.
@Test
public void testEndToEndOneNode() throws Exception {
String services = "<?xml version='1.0' encoding='UTF-8' ?>" + "<services version='1.0'>" + " <admin version='2.0'>" + " <adminserver hostalias='node1'/>" + " </admin>" + " <jdisc id='default' version='1.0'>" + " <search/>" + " <nodes>" + " <node hostalias='node1'/>" + " </nodes>" + " </jdisc>" + " <content id='storage' version='1.0'>" + " <redundancy>2</redundancy>" + " <group>" + " <node distribution-key='0' hostalias='node1'/>" + " <node distribution-key='1' hostalias='node1'/>" + " </group>" + " <tuning>" + " <cluster-controller>" + " <transition-time>0</transition-time>" + " </cluster-controller>" + " </tuning>" + " <documents>" + " <document mode='store-only' type='type1'/>" + " </documents>" + " <engine>" + " <proton/>" + " </engine>" + " </content>" + " </services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1");
VespaModel model = (new VespaModelCreatorWithMockPkg(null, services, sds)).create();
assertEquals(1, model.getContentClusters().get("storage").getDocumentDefinitions().size());
ContainerCluster cluster = model.getAdmin().getClusterControllers();
assertEquals(1, cluster.getContainers().size());
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class ClusterTest method testSearchTuning.
@Test
public void testSearchTuning() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node0\" />\n" + " <cluster-controllers>\n" + " <cluster-controller hostalias=\"node0\"/>" + " </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>\n" + " <cluster-controller>" + " <init-progress-time>34567</init-progress-time>" + " </cluster-controller>" + " </tuning>" + " </content>" + "\n" + "</services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create();
assertTrue(model.getContentClusters().get("bar").getPersistence() instanceof ProtonEngine.Factory);
{
StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder();
model.getConfig(builder, "bar/distributor/0");
StorDistributormanagerConfig config = new StorDistributormanagerConfig(builder);
assertEquals(false, config.inlinebucketsplitting());
}
{
StorFilestorConfig.Builder builder = new StorFilestorConfig.Builder();
model.getConfig(builder, "bar/storage/0");
StorFilestorConfig config = new StorFilestorConfig(builder);
assertEquals(false, config.enable_multibit_split_optimalization());
}
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class ClusterTest method testRedundancyRequired.
@Test
public void testRedundancyRequired() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node0\" />\n" + " </admin>\n" + " <content version='1.0' id='bar'>" + " <documents>" + " <document type=\"type1\" mode='index'/>\n" + " </documents>\n" + " <group>\n" + " <node hostalias='node0' distribution-key='0'/>\n" + " </group>\n" + " </content>\n" + "</services>\n";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
try {
new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create();
assertTrue("Deploying without redundancy should fail", false);
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage(), e.getMessage().contains("missing required element \"redundancy\""));
}
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class Bug6068056Test method testContainerClusterCalledDocproc.
@Test(expected = RuntimeException.class)
public void testContainerClusterCalledDocproc() throws Exception {
VespaModelCreatorWithMockPkg creator = new VespaModelCreatorWithMockPkg(HOSTS, SERVICES);
creator.create();
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class ValidationTester method deploy.
/**
* Deploys an application
*
* @param previousModel the previous model, or null if no previous
* @param services the services file content
* @param validationOverrides the validation overrides file content, or null if none
* @return the new model and any change actions
*/
public Pair<VespaModel, List<ConfigChangeAction>> deploy(VespaModel previousModel, String services, String validationOverrides) {
Instant now = LocalDate.parse("2000-01-01", DateTimeFormatter.ISO_DATE).atStartOfDay().atZone(ZoneOffset.UTC).toInstant();
ApplicationPackage newApp = new MockApplicationPackage.Builder().withServices(services).withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).withValidationOverrides(validationOverrides).build();
VespaModelCreatorWithMockPkg newModelCreator = new VespaModelCreatorWithMockPkg(newApp);
DeployState.Builder deployStateBuilder = new DeployState.Builder().applicationPackage(newApp).properties(new DeployProperties.Builder().hostedVespa(true).build()).modelHostProvisioner(new InMemoryProvisioner(nodeCount)).now(now);
if (previousModel != null)
deployStateBuilder.previousModel(previousModel);
VespaModel newModel = newModelCreator.create(deployStateBuilder);
return new Pair<>(newModel, newModelCreator.configChangeActions);
}
Aggregations