Search in sources :

Example 1 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class QrserverAndGatewayPortAllocationTest method testPorts.

@Test
public void testPorts() throws IOException, SAXException {
    String appDir = "src/test/cfg/application/app_qrserverandgw/";
    VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg(appDir);
    VespaModel vespaModel = creator.create();
    List<Container> qrservers = vespaModel.getContainerClusters().get("container").getContainers();
    assertThat(qrservers.size(), is(1));
    assertThat(qrservers.get(0).getSearchPort(), is(Container.BASEPORT));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) Container(com.yahoo.vespa.model.container.Container) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 2 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class SingleNodeProvisionerTest method require_allocate_clustermembership_works.

@Test
public void require_allocate_clustermembership_works() throws IOException, SAXException {
    String servicesXml = "<services version='1.0'>" + "  <admin version='3.0'>" + "    <nodes count='1' />" + "  </admin>" + "  <jdisc version='1.0'>" + "    <search />" + "    <nodes count='1' />" + "  </jdisc>" + "</services>";
    ApplicationPackage app = new MockApplicationPackage.Builder().withServices(servicesXml).build();
    VespaModel model = new VespaModel(app);
    assertThat(model.getHosts().size(), is(1));
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Example 3 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class ClusterControllerConfig method getConfig.

@Override
public void getConfig(FleetcontrollerConfig.Builder builder) {
    AbstractConfigProducerRoot root = getRoot();
    if (root instanceof VespaModel) {
        String zooKeeperAddress = root.getAdmin().getZooKeepersConfigProvider().getZooKeepersConnectionSpec();
        builder.zookeeper_server(zooKeeperAddress);
    } else {
        builder.zookeeper_server("");
    }
    builder.index(0);
    builder.cluster_name(clusterName);
    builder.fleet_controller_count(getChildren().size());
    if (initProgressTime != null) {
        builder.init_progress_time((int) initProgressTime.getMilliSeconds());
    }
    if (transitionTime != null) {
        builder.storage_transition_time((int) transitionTime.getMilliSeconds());
    }
    if (maxPrematureCrashes != null) {
        builder.max_premature_crashes(maxPrematureCrashes.intValue());
    }
    if (stableStateTimePeriod != null) {
        builder.stable_state_time_period((int) stableStateTimePeriod.getMilliSeconds());
    }
    if (minDistributorUpRatio != null) {
        builder.min_distributor_up_ratio(minDistributorUpRatio);
    }
    if (minStorageUpRatio != null) {
        builder.min_storage_up_ratio(minStorageUpRatio);
    }
    if (minSplitBits != null) {
        builder.ideal_distribution_bits(minSplitBits);
    }
    if (minNodeRatioPerGroup != null) {
        builder.min_node_ratio_per_group(minNodeRatioPerGroup);
    }
}
Also used : AbstractConfigProducerRoot(com.yahoo.config.model.producer.AbstractConfigProducerRoot) VespaModel(com.yahoo.vespa.model.VespaModel)

Example 4 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingTooFewNodes.

@Test
public void testUsingNodesCountAttributesAndGettingTooFewNodes() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + "  <admin version='3.0'>" + // Ignored
    "    <nodes count='3'/>" + "  </admin>" + "  <content version='1.0' id='bar'>" + "     <redundancy reply-after='8'>12</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='24'/>" + "     <engine><proton><searchable-copies>5</searchable-copies></proton></engine>" + "     <dispatch><num-dispatch-groups>7</num-dispatch-groups></dispatch>" + "  </content>" + "</services>";
    int numberOfHosts = 4;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, false);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    ContentCluster cluster = model.getContentClusters().get("bar");
    assertEquals(4, cluster.redundancy().effectiveInitialRedundancy());
    assertEquals(4, cluster.redundancy().effectiveFinalRedundancy());
    assertEquals(4, cluster.redundancy().effectiveReadyCopies());
    assertEquals(4, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
    assertFalse(cluster.getRootGroup().getPartitions().isPresent());
    assertEquals(4, cluster.getRootGroup().getNodes().size());
    assertEquals(0, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getNodes().size(), is(4));
    assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
    assertThat(cluster.getRootGroup().getNodes().get(1).getDistributionKey(), is(1));
    assertThat(cluster.getRootGroup().getNodes().get(1).getConfigId(), is("bar/storage/1"));
    assertThat(cluster.getRootGroup().getNodes().get(2).getDistributionKey(), is(2));
    assertThat(cluster.getRootGroup().getNodes().get(2).getConfigId(), is("bar/storage/2"));
    assertThat(cluster.getRootGroup().getNodes().get(3).getDistributionKey(), is(3));
    assertThat(cluster.getRootGroup().getNodes().get(3).getConfigId(), is("bar/storage/3"));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 5 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class ModelProvisioningTest method testThatStandaloneSyntaxWorksOnHostedVespa.

@Test
public void testThatStandaloneSyntaxWorksOnHostedVespa() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>" + "<jdisc id='foo' version='1.0'>" + "  <http>" + "    <server id='server1' port='" + getDefaults().vespaWebServicePort() + "' />" + "  </http>" + "</jdisc>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(1);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getHosts().size(), is(1));
    assertThat(model.getContainerClusters().size(), is(1));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)153 Test (org.junit.Test)135 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)35 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)26 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)21 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)18 DeployState (com.yahoo.config.model.deploy.DeployState)18 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)15 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)14 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)13 Matchers.containsString (org.hamcrest.Matchers.containsString)12 File (java.io.File)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)6 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)5 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)5 HostResource (com.yahoo.vespa.model.HostResource)5