use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AccessControlValidatorTest method cluster_with_handler_fails_validation_without_write_protection.
@Test
public void cluster_with_handler_fails_validation_without_write_protection() throws IOException, SAXException {
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("Access-control must be enabled for write operations to container clusters in production zones: [default]");
DeployState deployState = deployState(servicesXml(true, false));
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new AccessControlValidator().validate(model, deployState);
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AccessControlValidatorTest method no_http_element_has_same_effect_as_no_write_protection.
@Test
public void no_http_element_has_same_effect_as_no_write_protection() throws IOException, SAXException {
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("Access-control must be enabled for write operations to container clusters in production zones: [default]");
String servicesXml = joinLines("<services version='1.0'>", " <container id='default' version='1.0'>", httpHandlerXml, " </container>", "</services>");
DeployState deployState = deployState(servicesXml);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new AccessControlValidator().validate(model, deployState);
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class AccessControlValidatorTest method cluster_with_mbus_handler_passes_validation_without_write_protection.
@Test
public void cluster_with_mbus_handler_passes_validation_without_write_protection() throws IOException, SAXException {
String servicesXml = joinLines("<services version='1.0'>", " <container id='default' version='1.0'>", " <handler id='foo'>", " <binding>mbus://*/foo</binding>", " </handler>", " </container>", "</services>");
DeployState deployState = deployState(servicesXml);
VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
new AccessControlValidator().validate(model, deployState);
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class ContainerClusterTest method requireThatRoutingProviderIsDisabledForNonHosted.
@Test
public void requireThatRoutingProviderIsDisabledForNonHosted() {
DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(false).build()).build(true);
MockRoot root = new MockRoot("foo", state);
ContainerCluster cluster = new ContainerCluster(root, "container0", "container1");
RoutingProviderConfig.Builder builder = new RoutingProviderConfig.Builder();
cluster.getConfig(builder);
RoutingProviderConfig config = new RoutingProviderConfig(builder);
assertFalse(config.enabled());
assertEquals(0, cluster.getAllComponents().stream().map(c -> c.getClassId().getName()).filter(c -> c.equals("com.yahoo.jdisc.http.filter.security.RoutingConfigProvider")).count());
}
use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.
the class ContainerClusterTest method requreThatWeCanGetTheZoneConfig.
@Test
public void requreThatWeCanGetTheZoneConfig() {
DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(true).build()).zone(new Zone(SystemName.cd, Environment.test, RegionName.from("some-region"))).build(true);
MockRoot root = new MockRoot("foo", state);
ContainerCluster cluster = new ContainerCluster(root, "container0", "container1");
ConfigserverConfig.Builder builder = new ConfigserverConfig.Builder();
cluster.getConfig(builder);
ConfigserverConfig config = new ConfigserverConfig(builder);
assertEquals(Environment.test.value(), config.environment());
assertEquals("some-region", config.region());
assertEquals("cd", config.system());
}
Aggregations