Search in sources :

Example 1 with VespaModelCreatorWithMockPkg

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());
}
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 2 with VespaModelCreatorWithMockPkg

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());
    }
}
Also used : StorDistributormanagerConfig(com.yahoo.vespa.config.content.core.StorDistributormanagerConfig) StorFilestorConfig(com.yahoo.vespa.config.content.StorFilestorConfig) 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) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) Test(org.junit.Test)

Example 3 with VespaModelCreatorWithMockPkg

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\""));
    }
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) Test(org.junit.Test)

Example 4 with VespaModelCreatorWithMockPkg

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();
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) Test(org.junit.Test)

Example 5 with VespaModelCreatorWithMockPkg

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);
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) Instant(java.time.Instant) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) VespaModel(com.yahoo.vespa.model.VespaModel) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Pair(com.yahoo.collections.Pair)

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