Search in sources :

Example 6 with InMemoryProvisioner

use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.

the class StorageNodeTest method getConfig.

private StorDevicesConfig getConfig(boolean useVdsEngine) {
    String vdsConfig = useVdsEngine ? "    <engine>" + "      <vds/>" + "    </engine>" : "";
    String servicesXml = "<?xml version='1.0' encoding='utf-8' ?>" + "<services version='1.0'>" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0'/>" + "  </admin>" + "  <content version='1.0' id='zoo'>" + "    <redundancy>1</redundancy>" + "    <nodes count='1' />" + "    <documents>" + "      <document type='type1' mode='streaming' />" + "    </documents>" + vdsConfig + "  </content>" + "</services>";
    List<String> searchDefinitions = ApplicationPackageUtils.generateSearchDefinition("type1");
    VespaModelCreatorWithMockPkg modelCreator = new VespaModelCreatorWithMockPkg(null, servicesXml, searchDefinitions);
    ApplicationPackage appPkg = modelCreator.appPkg;
    boolean failOnOutOfCapacity = true;
    InMemoryProvisioner provisioner = new InMemoryProvisioner(failOnOutOfCapacity, "host1.yahoo.com", "host2.yahoo.com");
    DeployProperties.Builder builder = new DeployProperties.Builder();
    DeployProperties properties = builder.hostedVespa(true).build();
    DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).modelHostProvisioner(provisioner).properties(properties).build(true);
    VespaModel model = modelCreator.create(true, deployState);
    return model.getConfig(StorDevicesConfig.class, "zoo/storage/0");
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) 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)

Example 7 with InMemoryProvisioner

use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.

the class VespaModelTestCase method testNoMultitenantHostExported.

@Test
public void testNoMultitenantHostExported() throws IOException, SAXException {
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices("<services version='1.0'><admin version='3.0'><nodes count='1' /></admin></services>").build();
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com")).properties(new DeployProperties.Builder().configServerSpecs(Arrays.asList(new Configserver.Spec("cfghost", 1234, 1235, 1236))).multitenant(true).build()).build(true);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    AllocatedHosts info = model.allocatedHosts();
    assertEquals("Admin version 3 is ignored, and there are no other hosts to borrow for admin services", 0, info.getHosts().size());
}
Also used : AllocatedHosts(com.yahoo.config.provision.AllocatedHosts) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Aggregations

InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)7 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)6 DeployState (com.yahoo.config.model.deploy.DeployState)5 VespaModel (com.yahoo.vespa.model.VespaModel)5 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)4 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)4 Test (org.junit.Test)4 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)2 HostProvisioner (com.yahoo.config.model.api.HostProvisioner)2 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)2 Pair (com.yahoo.collections.Pair)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 SingleNodeProvisioner (com.yahoo.config.model.provision.SingleNodeProvisioner)1 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)1 File (java.io.File)1 Instant (java.time.Instant)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1