use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method createMockAWSClient.
private AWSClient createMockAWSClient(List<AutoScalingInstanceDetails> instanceDetailsList, List<Instance> instanceList, String... ids) {
AWSClient awsMock = mock(AWSClient.class);
when(awsMock.describeAutoScalingInstances(ids)).thenReturn(instanceDetailsList);
when(awsMock.describeInstances(ids)).thenReturn(instanceList);
when(awsMock.region()).thenReturn("us-east-1");
return awsMock;
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesNotExistingInASG.
@Test
public void testInstancesNotExistingInASG() {
List<AutoScalingInstanceDetails> instanceDetailsList = Collections.emptyList();
List<Instance> instanceList = createInstanceList();
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
List<Resource> resources = crawler.resources();
Assert.assertEquals(resources.size(), instanceList.size());
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestInstanceJanitorCrawler method testInstancesWithIds.
@Test
public void testInstancesWithIds() {
List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
List<Instance> instanceList = createInstanceList();
String[] ids = { "i-12345678901234560", "i-12345678901234561" };
AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList, ids);
InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
List<Resource> resources = crawler.resources(ids);
verifyInstanceList(resources, instanceDetailsList);
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestLaunchConfigJanitorCrawler method createMockAWSClient.
private AWSClient createMockAWSClient(List<AutoScalingGroup> asgList, List<LaunchConfiguration> lcList, String... lcNames) {
AWSClient awsMock = mock(AWSClient.class);
when(awsMock.describeAutoScalingGroups()).thenReturn(asgList);
when(awsMock.describeLaunchConfigurations(lcNames)).thenReturn(lcList);
when(awsMock.region()).thenReturn("us-east-1");
return awsMock;
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestELBJanitorCrawler method testElbsWithNoInstances.
@Test
public void testElbsWithNoInstances() {
boolean includeInstances = false;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
addELBsToMock(client, elbs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs);
}
Aggregations