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);
}
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"));
}
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));
}
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);
}
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());
}
Aggregations