Search in sources :

Example 21 with DeployState

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);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 22 with 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);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 23 with 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);
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 24 with 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());
}
Also used : QrStartConfig(com.yahoo.search.config.QrStartConfig) ClusterControllerContainer(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer) MetricDefaultsConfig(com.yahoo.container.jdisc.config.MetricDefaultsConfig) ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) RegionName(com.yahoo.config.provision.RegionName) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) HostResource(com.yahoo.vespa.model.HostResource) ClusterInfoConfig(com.yahoo.cloud.config.ClusterInfoConfig) ContainerSearch(com.yahoo.vespa.model.container.search.ContainerSearch) Host(com.yahoo.vespa.model.Host) ThreadpoolConfig(com.yahoo.container.handler.ThreadpoolConfig) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) Component(com.yahoo.vespa.model.container.component.Component) Iterator(java.util.Iterator) ContainerDocproc(com.yahoo.vespa.model.container.docproc.ContainerDocproc) Environment(com.yahoo.config.provision.Environment) Collection(java.util.Collection) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Assert.assertFalse(org.junit.Assert.assertFalse) Zone(com.yahoo.config.provision.Zone) SystemName(com.yahoo.config.provision.SystemName) Optional(java.util.Optional) SearchChains(com.yahoo.vespa.model.container.search.searchchain.SearchChains) ClusterControllerClusterVerifier(com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier) RoutingProviderConfig(com.yahoo.cloud.config.RoutingProviderConfig) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Assert.assertEquals(org.junit.Assert.assertEquals) RoutingProviderConfig(com.yahoo.cloud.config.RoutingProviderConfig) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Example 25 with DeployState

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());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) Test(org.junit.Test)

Aggregations

DeployState (com.yahoo.config.model.deploy.DeployState)29 Test (org.junit.Test)19 VespaModel (com.yahoo.vespa.model.VespaModel)14 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)10 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)9 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)7 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)7 Zone (com.yahoo.config.provision.Zone)7 MockRoot (com.yahoo.config.model.test.MockRoot)5 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 SentinelConfig (com.yahoo.cloud.config.SentinelConfig)2 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)2 TestDriver (com.yahoo.config.model.test.TestDriver)2 TestRoot (com.yahoo.config.model.test.TestRoot)2 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 Optional (java.util.Optional)2 ClusterInfoConfig (com.yahoo.cloud.config.ClusterInfoConfig)1