Search in sources :

Example 1 with TargetGroupAssociationLimitException

use of com.amazonaws.services.elasticloadbalancingv2.model.TargetGroupAssociationLimitException in project titus-control-plane by Netflix.

the class AwsLoadBalancerConnectorTest method validateExceptionsAreUnmodifiedWithMockClientTest.

@Test
public void validateExceptionsAreUnmodifiedWithMockClientTest() {
    Class defaultExceptionClass = TargetGroupAssociationLimitException.class;
    TestSubscriber testSubscriber = new TestSubscriber();
    AmazonElasticLoadBalancingAsync albClient = mock(AmazonElasticLoadBalancingAsync.class);
    when(albClient.describeTargetHealthAsync(any(), any())).thenThrow(defaultExceptionClass);
    awsLoadBalancerConnector = getAwsLoadBalancerConnector(albClient);
    awsLoadBalancerConnector.getLoadBalancer(targetGroupWithTargets).subscribe(testSubscriber);
    testSubscriber.awaitTerminalEvent();
    List<Throwable> errors = testSubscriber.getOnErrorEvents();
    assertEquals(1, errors.size());
    Throwable throwable = errors.get(0);
    assertFalse(throwable instanceof LoadBalancerException);
    assertTrue(throwable instanceof TargetGroupAssociationLimitException);
}
Also used : LoadBalancerException(com.netflix.titus.api.loadbalancer.service.LoadBalancerException) TestSubscriber(rx.observers.TestSubscriber) AmazonElasticLoadBalancingAsync(com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingAsync) TargetGroupAssociationLimitException(com.amazonaws.services.elasticloadbalancingv2.model.TargetGroupAssociationLimitException) Test(org.junit.Test)

Aggregations

AmazonElasticLoadBalancingAsync (com.amazonaws.services.elasticloadbalancingv2.AmazonElasticLoadBalancingAsync)1 TargetGroupAssociationLimitException (com.amazonaws.services.elasticloadbalancingv2.model.TargetGroupAssociationLimitException)1 LoadBalancerException (com.netflix.titus.api.loadbalancer.service.LoadBalancerException)1 Test (org.junit.Test)1 TestSubscriber (rx.observers.TestSubscriber)1