use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testGetLoadBalancerUserFacingFQDNNoLBs.
@Test
public void testGetLoadBalancerUserFacingFQDNNoLBs() {
Set<LoadBalancer> loadBalancers = Set.of();
when(loadBalancerPersistenceService.findByStackId(0L)).thenReturn(loadBalancers);
String fqdn = underTest.getLoadBalancerUserFacingFQDN(0L);
assertNull(fqdn);
}
use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testGetLoadBalancerUserFacingFQDNNoPublicPrivateMissingFQDN.
@Test
public void testGetLoadBalancerUserFacingFQDNNoPublicPrivateMissingFQDN() {
Set<LoadBalancer> loadBalancers = createPrivateOnlyLoadBalancer();
LoadBalancer privateLoadBalancer = loadBalancers.stream().filter(lb -> LoadBalancerType.PRIVATE.equals(lb.getType())).findFirst().get();
privateLoadBalancer.setFqdn(null);
privateLoadBalancer.setIp(null);
when(loadBalancerPersistenceService.findByStackId(0L)).thenReturn(loadBalancers);
String fqdn = underTest.getLoadBalancerUserFacingFQDN(0L);
assertEquals(PRIVATE_DNS, fqdn);
}
use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testCreateLoadBalancersForDatahubWithPrivateSubnet.
@Test
public void testCreateLoadBalancersForDatahubWithPrivateSubnet() {
Stack stack = createAwsStack(StackType.WORKLOAD, PRIVATE_ID_1);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AWS");
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(true);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
when(subnetSelector.findSubnetById(any(), anyString())).thenReturn(Optional.of(subnet));
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
assertEquals(1, loadBalancers.size());
assert loadBalancers.stream().anyMatch(l -> LoadBalancerType.PRIVATE.equals(l.getType()));
});
}
use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testCreateLoadBalancerNoAttributes.
@Test
public void testCreateLoadBalancerNoAttributes() {
Stack stack = createAwsStack(StackType.DATALAKE, null);
stack.getNetwork().setAttributes(null);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AWS");
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(false);
when(entitlementService.datalakeLoadBalancerEnabled(anyString())).thenReturn(true);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
assert loadBalancers.isEmpty();
});
}
use of com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer in project cloudbreak by hortonworks.
the class LoadBalancerConfigServiceTest method testCreateLoadBalancerNoSubnetSpecified.
@Test
public void testCreateLoadBalancerNoSubnetSpecified() {
Stack stack = createAwsStack(StackType.DATALAKE, null);
CloudSubnet subnet = getPrivateCloudSubnet(PRIVATE_ID_1, AZ_1);
DetailedEnvironmentResponse environment = createEnvironment(subnet, false, "AWS");
StackV4Request request = new StackV4Request();
request.setEnableLoadBalancer(false);
when(entitlementService.datalakeLoadBalancerEnabled(anyString())).thenReturn(true);
when(blueprint.getBlueprintText()).thenReturn(getBlueprintText("input/clouderamanager-knox.bp"));
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
Set<LoadBalancer> loadBalancers = underTest.createLoadBalancers(stack, environment, request);
assert loadBalancers.isEmpty();
});
}
Aggregations