use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestEBSSnapshotJanitorCrawler method createMockAWSClient.
private AWSClient createMockAWSClient(List<Snapshot> snapshotList, String... ids) {
AWSClient awsMock = mock(AWSClient.class);
when(awsMock.describeSnapshots(ids)).thenReturn(snapshotList);
when(awsMock.region()).thenReturn("us-east-1");
return awsMock;
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestEBSVolumeJanitorCrawler method createMockAWSClient.
private AWSClient createMockAWSClient(List<Volume> volumeList, String... ids) {
AWSClient awsMock = mock(AWSClient.class);
when(awsMock.describeVolumes(ids)).thenReturn(volumeList);
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 testElbsWithReferencedASGs.
@Test
public void testElbsWithReferencedASGs() {
boolean includeInstances = true;
boolean includeELbs = true;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
List<AutoScalingGroup> asgs = createASGList(includeELbs);
addELBsToMock(client, elbs);
addASGsToMock(client, asgs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs, 1);
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestELBJanitorCrawler method testElbsWithInstances.
@Test
public void testElbsWithInstances() {
boolean includeInstances = true;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
addELBsToMock(client, elbs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs);
}
use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.
the class TestELBJanitorCrawler method testElbsWithNoReferencedASGs.
@Test
public void testElbsWithNoReferencedASGs() {
boolean includeInstances = true;
boolean includeELbs = false;
AWSClient client = createMockAWSClient();
List<LoadBalancerDescription> elbs = createELBList(includeInstances);
List<AutoScalingGroup> asgs = createASGList(includeELbs);
addELBsToMock(client, elbs);
addASGsToMock(client, asgs);
ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
List<Resource> resources = crawler.resources();
verifyELBList(resources, elbs, 0);
}
Aggregations