Search in sources :

Example 6 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AccessControlValidatorTest method write_protection_is_not_required_for_non_default_application_type.

@Test
public void write_protection_is_not_required_for_non_default_application_type() throws IOException, SAXException {
    String servicesXml = joinLines("<services version='1.0' application-type='hosted-infrastructure'>", "  <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 7 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class ContainerClusterTest method createContainerCluster.

private ContainerCluster createContainerCluster(boolean isHosted, boolean isCombinedCluster, Optional<Integer> memoryPercentage, Optional<ContainerClusterVerifier> extraComponents) {
    DeployState state = new DeployState.Builder().properties(new DeployProperties.Builder().hostedVespa(isHosted).build()).build(true);
    MockRoot root = new MockRoot("foo", state);
    ContainerCluster cluster = extraComponents.isPresent() ? new ContainerCluster(root, "container0", "container1", extraComponents.get()) : new ContainerCluster(root, "container0", "container1");
    if (isCombinedCluster)
        cluster.setHostClusterId("test-content-cluster");
    cluster.setMemoryPercentage(memoryPercentage);
    cluster.setSearch(new ContainerSearch(cluster, new SearchChains(cluster, "search-chain"), new ContainerSearch.Options()));
    return cluster;
}
Also used : SearchChains(com.yahoo.vespa.model.container.search.searchchain.SearchChains) DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) ContainerSearch(com.yahoo.vespa.model.container.search.ContainerSearch)

Example 8 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class ContainerModelBuilderTest method http_aliases_are_only_honored_in_prod_environment.

@Test
public void http_aliases_are_only_honored_in_prod_environment() throws SAXException, IOException {
    Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'>", "  <aliases>", "    <service-alias>service1</service-alias>", "    <endpoint-alias>foo1.bar1.com</endpoint-alias>", "  </aliases>", "  <nodes>", "    <node hostalias='host1' />", "  </nodes>", "</jdisc>");
    DeployState deployState = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("us-east-1"))).build(true);
    createModel(root, deployState, clusterElem);
    assertEquals(0, getContainerCluster("default").serviceAliases().size());
    assertEquals(0, getContainerCluster("default").endpointAliases().size());
    assertNull(getContainerCluster("default").getContainers().get(0).getServicePropertyString("servicealiases"));
    assertNull(getContainerCluster("default").getContainers().get(0).getServicePropertyString("endpointaliases"));
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) Zone(com.yahoo.config.provision.Zone) Element(org.w3c.dom.Element) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 9 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class DeploymentFileValidatorTest method testDeploymentWithNonExistentGlobalId.

@Test
public void testDeploymentWithNonExistentGlobalId() throws IOException, SAXException {
    final String simpleHosts = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<hosts>  " + "<host name=\"localhost\">" + "<alias>node0</alias>" + "</host>" + "</hosts>";
    final String services = "<services version='1.0'>" + "  <admin  version='2.0'>" + "    <adminserver hostalias='node0' />" + "  </admin>" + "  <jdisc id='default' version='1.0'>" + "    <search/>" + "      <nodes>" + "        <node hostalias='node0'/>" + "     </nodes>" + "   </jdisc>" + "</services>";
    final String deploymentSpec = "<?xml version='1.0' encoding='UTF-8'?>" + "<deployment version='1.0'>" + "  <test />" + "  <prod global-service-id='non-existing'>" + "    <region active='true'>us-east</region>" + "  </prod>" + "</deployment>";
    ApplicationPackage app = new MockApplicationPackage.Builder().withHosts(simpleHosts).withServices(services).withDeploymentSpec(deploymentSpec).build();
    DeployState.Builder builder = new DeployState.Builder().applicationPackage(app);
    try {
        final DeployState deployState = builder.build(true);
        VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
        new DeploymentFileValidator().validate(model, deployState);
        fail("Did not get expected exception");
    } catch (IllegalArgumentException e) {
        assertThat(e.getMessage(), containsString("specified in deployment.xml does not match any container cluster id"));
    }
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Example 10 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class IndexedTest method requireMultipleDocumentTypes.

@Test
public void requireMultipleDocumentTypes() {
    VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator();
    VespaModel model = creator.create();
    DeployState deployState = creator.deployState;
    IndexedSearchCluster cluster = model.getContentClusters().get("test").getSearch().getIndexed();
    assertEquals(3, cluster.getDocumentDbs().size());
    NewDocumentType type1 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type1");
    NewDocumentType type2 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type2");
    NewDocumentType type3 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type3");
    assertNotNull(type1);
    assertNotNull(type2);
    assertNotNull(type3);
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) 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