Search in sources :

Example 11 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method testInstancesWithNames.

@Test
public void testInstancesWithNames() {
    List<AutoScalingGroup> asgList = createASGList();
    String[] asgNames = { "asg1", "asg2" };
    AWSClient awsMock = createMockAWSClient(asgList, asgNames);
    ASGJanitorCrawler crawler = new ASGJanitorCrawler(awsMock);
    List<Resource> resources = crawler.resources(asgNames);
    verifyASGList(resources, asgList);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) Test(org.testng.annotations.Test)

Example 12 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method testInstancesWithResourceType.

@Test
public void testInstancesWithResourceType() {
    List<AutoScalingGroup> asgList = createASGList();
    AWSClient awsMock = createMockAWSClient(asgList);
    ASGJanitorCrawler crawler = new ASGJanitorCrawler(awsMock);
    for (AWSResourceType resourceType : AWSResourceType.values()) {
        List<Resource> resources = crawler.resources(resourceType);
        if (resourceType == AWSResourceType.ASG) {
            verifyASGList(resources, asgList);
        } else {
            Assert.assertTrue(resources.isEmpty());
        }
    }
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) AWSResourceType(com.netflix.simianarmy.aws.AWSResourceType) Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) Test(org.testng.annotations.Test)

Example 13 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestELBJanitorCrawler method testResourceTypes.

@Test
public void testResourceTypes() {
    boolean includeInstances = false;
    AWSClient client = createMockAWSClient();
    addELBsToMock(client, createELBList(includeInstances));
    ELBJanitorCrawler crawler = new ELBJanitorCrawler(client);
    EnumSet<?> types = crawler.resourceTypes();
    Assert.assertEquals(types.size(), 1);
    Assert.assertEquals(types.iterator().next().name(), "ELB");
}
Also used : AWSClient(com.netflix.simianarmy.client.aws.AWSClient) Test(org.testng.annotations.Test)

Example 14 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestInstanceJanitorCrawler method testInstancesWithNullIds.

@Test
public void testInstancesWithNullIds() {
    List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
    List<Instance> instanceList = createInstanceList();
    AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
    InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
    List<Resource> resources = crawler.resources();
    verifyInstanceList(resources, instanceDetailsList);
}
Also used : Instance(com.amazonaws.services.ec2.model.Instance) Resource(com.netflix.simianarmy.Resource) AWSResource(com.netflix.simianarmy.aws.AWSResource) AutoScalingInstanceDetails(com.amazonaws.services.autoscaling.model.AutoScalingInstanceDetails) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) Test(org.testng.annotations.Test)

Example 15 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestInstanceJanitorCrawler method testInstancesWithResourceType.

@Test
public void testInstancesWithResourceType() {
    List<AutoScalingInstanceDetails> instanceDetailsList = createInstanceDetailsList();
    List<Instance> instanceList = createInstanceList();
    AWSClient awsMock = createMockAWSClient(instanceDetailsList, instanceList);
    InstanceJanitorCrawler crawler = new InstanceJanitorCrawler(awsMock);
    for (AWSResourceType resourceType : AWSResourceType.values()) {
        List<Resource> resources = crawler.resources(resourceType);
        if (resourceType == AWSResourceType.INSTANCE) {
            verifyInstanceList(resources, instanceDetailsList);
        } else {
            Assert.assertTrue(resources.isEmpty());
        }
    }
}
Also used : Instance(com.amazonaws.services.ec2.model.Instance) AWSResourceType(com.netflix.simianarmy.aws.AWSResourceType) Resource(com.netflix.simianarmy.Resource) AWSResource(com.netflix.simianarmy.aws.AWSResource) AutoScalingInstanceDetails(com.amazonaws.services.autoscaling.model.AutoScalingInstanceDetails) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) 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