Search in sources :

Example 16 with AWSClient

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;
}
Also used : AWSClient(com.netflix.simianarmy.client.aws.AWSClient)

Example 17 with AWSClient

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;
}
Also used : AWSClient(com.netflix.simianarmy.client.aws.AWSClient)

Example 18 with AWSClient

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);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) LoadBalancerDescription(com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription) Test(org.testng.annotations.Test)

Example 19 with AWSClient

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);
}
Also used : Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) LoadBalancerDescription(com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription) Test(org.testng.annotations.Test)

Example 20 with AWSClient

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);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) LoadBalancerDescription(com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription) Test(org.testng.annotations.Test)

Aggregations

AWSClient (com.netflix.simianarmy.client.aws.AWSClient)37 Resource (com.netflix.simianarmy.Resource)18 Test (org.testng.annotations.Test)15 AutoScalingGroup (com.amazonaws.services.autoscaling.model.AutoScalingGroup)11 AWSResource (com.netflix.simianarmy.aws.AWSResource)10 Instance (com.amazonaws.services.ec2.model.Instance)7 LoadBalancerDescription (com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription)6 AutoScalingInstanceDetails (com.amazonaws.services.autoscaling.model.AutoScalingInstanceDetails)5 LinkedList (java.util.LinkedList)4 Tag (com.amazonaws.services.ec2.model.Tag)3 Instance (com.amazonaws.services.autoscaling.model.Instance)2 LaunchConfiguration (com.amazonaws.services.autoscaling.model.LaunchConfiguration)2 SuspendedProcess (com.amazonaws.services.autoscaling.model.SuspendedProcess)2 TagDescription (com.amazonaws.services.autoscaling.model.TagDescription)2 AmazonSimpleDB (com.amazonaws.services.simpledb.AmazonSimpleDB)2 AWSResourceType (com.netflix.simianarmy.aws.AWSResourceType)2 Cluster (com.netflix.simianarmy.conformity.Cluster)2 GroupIdentifier (com.amazonaws.services.ec2.model.GroupIdentifier)1 Snapshot (com.amazonaws.services.ec2.model.Snapshot)1 Volume (com.amazonaws.services.ec2.model.Volume)1