Search in sources :

Example 1 with Zone

use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.

the class RoutingBuilderTest method getContainer.

private Container getContainer(ApplicationPackage applicationPackage, String region, Element clusterElem) throws IOException, SAXException {
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).zone(new Zone(Environment.prod, RegionName.from(region))).build(true);
    root = new MockRoot("root", deployState);
    createModel(root, deployState, clusterElem);
    ContainerCluster cluster = getContainerCluster("default");
    return cluster.getContainers().get(0);
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) MockRoot(com.yahoo.config.model.test.MockRoot) Zone(com.yahoo.config.provision.Zone) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster)

Example 2 with Zone

use of com.yahoo.config.provision.Zone 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 3 with Zone

use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.

the class ApplicationHandlerTest method testFileDistributionStatus.

@Test
public void testFileDistributionStatus() throws Exception {
    long sessionId = 1;
    ApplicationId application = new ApplicationId.Builder().applicationName(ApplicationName.defaultName()).tenant(mytenantName).build();
    addMockApplication(tenants.getTenant(mytenantName), application, sessionId, Clock.systemUTC());
    Zone zone = Zone.defaultZone();
    HttpResponse response = fileDistributionStatus(application, zone);
    assertEquals(200, response.getStatus());
    SessionHandlerTest.getRenderedString(response);
    assertEquals("{\"hosts\":[{\"hostname\":\"mytesthost\",\"status\":\"UNKNOWN\",\"message\":\"error: Connection error(104)\",\"fileReferences\":[]}],\"status\":\"UNKNOWN\"}", SessionHandlerTest.getRenderedString(response));
    // 404 for unknown application
    ApplicationId unknown = new ApplicationId.Builder().applicationName("unknown").tenant(mytenantName).build();
    HttpResponse responseForUnknown = fileDistributionStatus(unknown, zone);
    assertEquals(404, responseForUnknown.getStatus());
    assertEquals("{\"error-code\":\"NOT_FOUND\",\"message\":\"No such application id: mytenant.unknown\"}", SessionHandlerTest.getRenderedString(responseForUnknown));
}
Also used : Zone(com.yahoo.config.provision.Zone) HttpResponse(com.yahoo.container.jdisc.HttpResponse) ApplicationId(com.yahoo.config.provision.ApplicationId) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) Test(org.junit.Test)

Example 4 with Zone

use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.

the class LbServicesProducerTest method createModelAndGetLbServicesConfig.

private LbServicesConfig createModelAndGetLbServicesConfig(RegionName regionName) throws IOException, SAXException {
    final Zone zone = new Zone(Environment.prod, regionName);
    Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder().zone(zone).properties(new DeployProperties.Builder().build()).zone(zone));
    return getLbServicesConfig(new Zone(Environment.prod, regionName), testModel);
}
Also used : Zone(com.yahoo.config.provision.Zone) TenantName(com.yahoo.config.provision.TenantName) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 5 with Zone

use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.

the class ModelGeneratorTest method toApplicationModel.

@Test
public void toApplicationModel() throws Exception {
    SuperModel superModel = ExampleModel.createExampleSuperModelWithOneRpcPort(HOSTNAME, PORT);
    ModelGenerator modelGenerator = new ModelGenerator();
    Zone zone = new Zone(Environment.from(ENVIRONMENT), RegionName.from(REGION));
    List<String> configServerHosts = Collections.emptyList();
    SlobrokMonitorManagerImpl slobrokMonitorManager = mock(SlobrokMonitorManagerImpl.class);
    when(slobrokMonitorManager.getStatus(any(), any(), any(), any())).thenReturn(ServiceStatus.UP);
    ServiceModel serviceModel = modelGenerator.toServiceModel(superModel, zone, configServerHosts, slobrokMonitorManager);
    Map<ApplicationInstanceReference, ApplicationInstance> applicationInstances = serviceModel.getAllApplicationInstances();
    assertEquals(1, applicationInstances.size());
    verifyOtherApplication(applicationInstances.values().iterator().next());
}
Also used : ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) ServiceModel(com.yahoo.vespa.service.monitor.ServiceModel) SuperModel(com.yahoo.config.model.api.SuperModel) Zone(com.yahoo.config.provision.Zone) ApplicationInstanceReference(com.yahoo.vespa.applicationmodel.ApplicationInstanceReference) Test(org.junit.Test)

Aggregations

Zone (com.yahoo.config.provision.Zone)71 Test (org.junit.Test)64 ApplicationId (com.yahoo.config.provision.ApplicationId)51 Node (com.yahoo.vespa.hosted.provision.Node)17 Flavor (com.yahoo.config.provision.Flavor)15 ClusterSpec (com.yahoo.config.provision.ClusterSpec)13 HostSpec (com.yahoo.config.provision.HostSpec)12 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)10 HashSet (java.util.HashSet)8 DeployState (com.yahoo.config.model.deploy.DeployState)6 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Curator (com.yahoo.vespa.curator.Curator)6 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)6 NodeList (com.yahoo.vespa.hosted.provision.NodeList)6 MockNameResolver (com.yahoo.vespa.hosted.provision.testutils.MockNameResolver)6 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)5 Version (com.yahoo.component.Version)5 RegionName (com.yahoo.config.provision.RegionName)5 TenantName (com.yahoo.config.provision.TenantName)5 FlavorsConfig (com.yahoo.config.provisioning.FlavorsConfig)5