use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AdminTestCase method testDisableFileDistributorForAllApps.
@Test
public void testDisableFileDistributorForAllApps() {
DeployState state = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("baz"))).properties(new DeployProperties.Builder().applicationId(new ApplicationId.Builder().tenant("quux").applicationName("foo").instanceName("bim").build()).build()).build(true);
TestRoot root = new TestDriver().buildModel(state);
String localhost = HostName.getLocalhost();
SentinelConfig sentinelConfig = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
assertThat(sentinelConfig.service().size(), is(3));
assertThat(sentinelConfig.service(0).name(), is("logserver"));
assertThat(sentinelConfig.service(1).name(), is("slobrok"));
assertThat(sentinelConfig.service(2).name(), is("logd"));
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AdminTestCase method testTenantAndAppInSentinelConfig.
@Test
public void testTenantAndAppInSentinelConfig() {
DeployState state = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("baz"))).properties(new DeployProperties.Builder().applicationId(new ApplicationId.Builder().tenant("quux").applicationName("foo").instanceName("bim").build()).build()).build(true);
TestRoot root = new TestDriver().buildModel(state);
String localhost = HostName.getLocalhost();
SentinelConfig config = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
assertThat(config.application().tenant(), is("quux"));
assertThat(config.application().name(), is("foo"));
assertThat(config.application().environment(), is("dev"));
assertThat(config.application().region(), is("baz"));
assertThat(config.application().instance(), is("bim"));
}
use of com.yahoo.config.model.deploy.DeployState 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());
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class VespaModelCreatorWithFilePkg method create.
public VespaModel create(boolean validateApplicationWithSchema) {
try {
if (validateApplicationWithSchema) {
validate();
}
DeployState deployState = new DeployState.Builder().applicationPackage(applicationPkg).build(true);
VespaModel model = new VespaModel(configModelRegistry, deployState);
// Validate, but without checking configSources or routing (routing
// is constructed in a special way and cannot always be validated in
// this step for unit tests)
Validation.validate(model, false, false, deployState);
return model;
} catch (Exception e) {
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
}
}
Aggregations