use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.
the class DeployStateTest method testProvisionerIsSet.
@Test
public void testProvisionerIsSet() {
DeployState.Builder builder = new DeployState.Builder();
HostProvisioner provisioner = new InMemoryProvisioner(true, "foo.yahoo.com");
builder.modelHostProvisioner(provisioner);
DeployState state = builder.build(true);
assertThat(state.getProvisioner(), is(provisioner));
}
use of com.yahoo.config.model.provision.InMemoryProvisioner 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);
}
use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.
the class ContainerModelBuilderTest method singlenode_servicespec_is_used_with_hosted_vespa.
@Test
public void singlenode_servicespec_is_used_with_hosted_vespa() throws IOException, SAXException {
String servicesXml = "<jdisc id='default' version='1.0' />";
ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com", "host2.yahoo.com")).applicationPackage(applicationPackage).properties(new DeployProperties.Builder().multitenant(true).hostedVespa(true).build()).build(true));
assertEquals(1, model.getHostSystem().getHosts().size());
}
use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.
the class VespaModelTester method createModel.
/**
* Creates a model using the hosts already added to this
*
* @param services the services xml string
* @param failOnOutOfCapacity whether we should get an exception when not enough hosts of the requested flavor
* is available or if we should just silently receive a smaller allocation
* @return the resulting model
*/
public VespaModel createModel(String services, boolean failOnOutOfCapacity, int startIndexForClusters, String... retiredHostNames) {
VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
HostProvisioner provisioner = hosted ? new InMemoryProvisioner(hostsByFlavor, failOnOutOfCapacity, startIndexForClusters, retiredHostNames) : new SingleNodeProvisioner();
DeployProperties properties = new DeployProperties.Builder().hostedVespa(hosted).applicationId(applicationId).build();
DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).modelHostProvisioner(provisioner).properties(properties).build(true);
return modelCreatorWithMockPkg.create(false, deployState, configModelRegistry);
}
use of com.yahoo.config.model.provision.InMemoryProvisioner in project vespa by vespa-engine.
the class StaticProvisionerTest method sameHostsAreProvisioned.
@Test
public void sameHostsAreProvisioned() throws IOException, SAXException {
ApplicationPackage app = FilesApplicationPackage.fromFile(new File("src/test/apps/hosted"));
InMemoryProvisioner inMemoryHostProvisioner = new InMemoryProvisioner(false, "host1.yahoo.com", "host2.yahoo.com", "host3.yahoo.com", "host4.yahoo.com");
VespaModel firstModel = createModel(app, inMemoryHostProvisioner);
StaticProvisioner staticProvisioner = new StaticProvisioner(firstModel.allocatedHosts());
VespaModel secondModel = createModel(app, staticProvisioner);
assertModelConfig(firstModel, secondModel);
}
Aggregations