Search in sources :

Example 16 with Container

use of com.yahoo.vespa.model.container.Container in project vespa by vespa-engine.

the class RoutingBuilderTest method setsRotationActiveAccordingToDeploymentSpec.

@Test
public void setsRotationActiveAccordingToDeploymentSpec() throws IOException, SAXException {
    Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'><search /></jdisc>");
    String deploymentSpec = "<deployment>\n" + "  <prod>    \n" + "    <region active='true'>us-north-1</region>\n" + "    <parallel>\n" + "      <region active='false'>us-north-2</region>\n" + "      <region active='true'>us-north-3</region>\n" + "    </parallel>\n" + "    <region active='false'>us-north-4</region>\n" + "  </prod>\n" + "</deployment>";
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withDeploymentSpec(deploymentSpec).build();
    // root = new MockRoot("root", applicationPackage);
    for (String region : Arrays.asList("us-north-1", "us-north-3")) {
        Container container = getContainer(applicationPackage, region, clusterElem);
        assertEquals("Region " + region + " is active", "true", container.getServicePropertyString("activeRotation"));
    }
    for (String region : Arrays.asList("us-north-2", "us-north-4")) {
        Container container = getContainer(applicationPackage, region, clusterElem);
        assertEquals("Region " + region + " is inactive", "false", container.getServicePropertyString("activeRotation"));
    }
    Container container = getContainer(applicationPackage, "unknown", clusterElem);
    assertEquals("Unknown region is inactive", "false", container.getServicePropertyString("activeRotation"));
}
Also used : Container(com.yahoo.vespa.model.container.Container) Element(org.w3c.dom.Element) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Aggregations

Container (com.yahoo.vespa.model.container.Container)16 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 Element (org.w3c.dom.Element)4 Path (java.nio.file.Path)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 HostResource (com.yahoo.vespa.model.HostResource)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 ZookeeperServerConfig (com.yahoo.cloud.config.ZookeeperServerConfig)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ClusterControllerCluster (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerCluster)1 ClusterControllerClusterVerifier (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerClusterVerifier)1 ClusterControllerContainer (com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 DocumentProcessor (com.yahoo.vespa.model.container.docproc.DocumentProcessor)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1