use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.
the class UnionMonitorManagerTest method nodeAdminOutsideContainer.
@Test
public void nodeAdminOutsideContainer() {
boolean inContainer = false;
// When nodeAdminInContainer is set, then only the node admin cluster should use health
testWith(inContainer, ZONE_APPLICATION_ID, NODE_ADMIN, CONTAINER, 0, 1);
testWith(inContainer, ApplicationId.fromSerializedForm("a:b:default"), NODE_ADMIN, CONTAINER, 1, 0);
testWith(inContainer, ZONE_APPLICATION_ID, new ClusterId("foo"), CONTAINER, 1, 0);
testWith(inContainer, ZONE_APPLICATION_ID, NODE_ADMIN, new ServiceType("foo"), 1, 0);
}
use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.
the class ModelGenerator method toServiceClusterKey.
private ServiceClusterKey toServiceClusterKey(ServiceInfo serviceInfo) {
ClusterId clusterId = getClusterId(serviceInfo);
ServiceType serviceType = toServiceType(serviceInfo);
return new ServiceClusterKey(clusterId, serviceType);
}
use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.
the class ClusterApiImplTest method testServicesDownAndNotInGroup.
@Test
public void testServicesDownAndNotInGroup() {
HostName hostName1 = modelUtils.createNode("host1", HostStatus.NO_REMARKS);
HostName hostName2 = modelUtils.createNode("host2", HostStatus.NO_REMARKS);
HostName hostName3 = modelUtils.createNode("host3", HostStatus.ALLOWED_TO_BE_DOWN);
HostName hostName4 = modelUtils.createNode("host4", HostStatus.ALLOWED_TO_BE_DOWN);
HostName hostName5 = modelUtils.createNode("host5", HostStatus.NO_REMARKS);
ServiceCluster serviceCluster = modelUtils.createServiceCluster("cluster", new ServiceType("service-type"), Arrays.asList(modelUtils.createServiceInstance("service-1", hostName1, ServiceStatus.UP), modelUtils.createServiceInstance("service-2", hostName2, ServiceStatus.DOWN), modelUtils.createServiceInstance("service-3", hostName3, ServiceStatus.UP), modelUtils.createServiceInstance("service-4", hostName4, ServiceStatus.DOWN), modelUtils.createServiceInstance("service-5", hostName5, ServiceStatus.UP)));
ClusterApiImpl clusterApi = new ClusterApiImpl(applicationApi, serviceCluster, new NodeGroup(modelUtils.createApplicationInstance(new ArrayList<>()), hostName5), modelUtils.getHostStatusMap(), modelUtils.getClusterControllerClientFactory());
assertEquals("{ clusterId=cluster, serviceType=service-type }", clusterApi.clusterInfo());
assertFalse(clusterApi.isStorageCluster());
assertEquals("[ServiceInstance{configId=service-2, hostName=host2, serviceStatus=DOWN}, " + "ServiceInstance{configId=service-3, hostName=host3, serviceStatus=UP}, " + "ServiceInstance{configId=service-4, hostName=host4, serviceStatus=DOWN}]", clusterApi.servicesDownAndNotInGroupDescription());
assertEquals("[host3, host4]", clusterApi.nodesAllowedToBeDownNotInGroupDescription());
assertEquals(60, clusterApi.percentageOfServicesDown());
assertEquals(80, clusterApi.percentageOfServicesDownIfGroupIsAllowedToBeDown());
}
use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.
the class HostedVespaClusterPolicyTest method testAdminSuspensionLimit.
@Test
public void testAdminSuspensionLimit() {
when(clusterApi.clusterId()).thenReturn(VespaModelUtil.ADMIN_CLUSTER_ID);
when(clusterApi.serviceType()).thenReturn(new ServiceType("non-slobrok-service-type"));
assertEquals(ConcurrentSuspensionLimitForCluster.ALL_NODES, policy.getConcurrentSuspensionLimit(clusterApi));
}
use of com.yahoo.vespa.applicationmodel.ServiceType in project vespa by vespa-engine.
the class InstanceResourceTest method testGetServiceStatus.
@Test
public void testGetServiceStatus() {
ServiceType serviceType = new ServiceType("serviceType");
ConfigId configId = new ConfigId("configId");
ServiceStatus serviceStatus = ServiceStatus.UP;
when(slobrokApi.getStatus(APPLICATION_ID, CLUSTER_ID, serviceType, configId)).thenReturn(serviceStatus);
ServiceStatus actualServiceStatus = resource.getServiceStatus(APPLICATION_INSTANCE_REFERENCE, CLUSTER_ID.s(), serviceType.s(), configId.s());
verify(slobrokApi).getStatus(APPLICATION_ID, CLUSTER_ID, serviceType, configId);
assertEquals(serviceStatus, actualServiceStatus);
}
Aggregations