Search in sources :

Example 1 with ServiceType

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);
}
Also used : ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Example 2 with ServiceType

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);
}
Also used : ServiceClusterKey(com.yahoo.vespa.applicationmodel.ServiceClusterKey) ClusterId(com.yahoo.vespa.applicationmodel.ClusterId) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType)

Example 3 with 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());
}
Also used : ServiceCluster(com.yahoo.vespa.applicationmodel.ServiceCluster) ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) HostName(com.yahoo.vespa.applicationmodel.HostName) Test(org.junit.Test)

Example 4 with ServiceType

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));
}
Also used : ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) Test(org.junit.Test)

Example 5 with ServiceType

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);
}
Also used : ServiceType(com.yahoo.vespa.applicationmodel.ServiceType) ServiceStatus(com.yahoo.vespa.applicationmodel.ServiceStatus) ConfigId(com.yahoo.vespa.applicationmodel.ConfigId) Test(org.junit.Test)

Aggregations

ServiceType (com.yahoo.vespa.applicationmodel.ServiceType)19 Test (org.junit.Test)14 HostName (com.yahoo.vespa.applicationmodel.HostName)10 ServiceCluster (com.yahoo.vespa.applicationmodel.ServiceCluster)9 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)7 ClusterId (com.yahoo.vespa.applicationmodel.ClusterId)7 ConfigId (com.yahoo.vespa.applicationmodel.ConfigId)6 ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)5 ApplicationInstanceId (com.yahoo.vespa.applicationmodel.ApplicationInstanceId)4 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)4 TenantId (com.yahoo.vespa.applicationmodel.TenantId)4 ApplicationId (com.yahoo.config.provision.ApplicationId)3 ServiceClusterKey (com.yahoo.vespa.applicationmodel.ServiceClusterKey)2 ServiceStatus (com.yahoo.vespa.applicationmodel.ServiceStatus)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)1 HostInfo (com.yahoo.config.model.api.HostInfo)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1