Search in sources :

Example 11 with AutoScalingGroup

use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method mkASG.

private AutoScalingGroup mkASG(String asgName) {
    AutoScalingGroup asg = new AutoScalingGroup().withAutoScalingGroupName(asgName);
    // set the suspended processes
    List<SuspendedProcess> sps = new ArrayList<SuspendedProcess>();
    sps.add(new SuspendedProcess().withProcessName("Launch").withSuspensionReason("User suspended at 2012-12-02T23:00:03"));
    sps.add(new SuspendedProcess().withProcessName("AddToLoadBalancer").withSuspensionReason("User suspended at 2012-12-03T23:00:03"));
    asg.setSuspendedProcesses(sps);
    return asg;
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) ArrayList(java.util.ArrayList) SuspendedProcess(com.amazonaws.services.autoscaling.model.SuspendedProcess)

Example 12 with AutoScalingGroup

use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method verifyASGList.

private void verifyASGList(List<Resource> resources, List<AutoScalingGroup> asgList) {
    Assert.assertEquals(resources.size(), asgList.size());
    for (int i = 0; i < resources.size(); i++) {
        AutoScalingGroup asg = asgList.get(i);
        verifyASG(resources.get(i), asg.getAutoScalingGroupName());
    }
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup)

Example 13 with AutoScalingGroup

use of com.amazonaws.services.autoscaling.model.AutoScalingGroup 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)

Example 14 with AutoScalingGroup

use of com.amazonaws.services.autoscaling.model.AutoScalingGroup 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 15 with AutoScalingGroup

use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.

the class TestVSphereGroups method shouldReturnListContainigSingleASGWhenAddInstanceIsCalledOnce.

@Test
public void shouldReturnListContainigSingleASGWhenAddInstanceIsCalledOnce() {
    VSphereGroups groups = new VSphereGroups();
    groups.addInstance("anyInstanceId", "anyGroupName");
    List<AutoScalingGroup> list = groups.asList();
    assertEquals(1, list.size());
    AutoScalingGroup firstItem = list.get(0);
    assertEquals("anyGroupName", firstItem.getAutoScalingGroupName());
    List<Instance> instances = firstItem.getInstances();
    assertEquals(1, instances.size());
    assertEquals("anyInstanceId", instances.get(0).getInstanceId());
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Instance(com.amazonaws.services.autoscaling.model.Instance) Test(org.testng.annotations.Test)

Aggregations

AutoScalingGroup (com.amazonaws.services.autoscaling.model.AutoScalingGroup)34 Test (org.testng.annotations.Test)16 AWSClient (com.netflix.simianarmy.client.aws.AWSClient)11 Instance (com.amazonaws.services.autoscaling.model.Instance)9 TagDescription (com.amazonaws.services.autoscaling.model.TagDescription)9 Resource (com.netflix.simianarmy.Resource)8 DescribeAutoScalingGroupsRequest (com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest)5 DescribeAutoScalingGroupsResult (com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsResult)4 HashSet (java.util.HashSet)4 SuspendedProcess (com.amazonaws.services.autoscaling.model.SuspendedProcess)3 LoadBalancerDescription (com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription)3 BasicInstanceGroup (com.netflix.simianarmy.basic.chaos.BasicInstanceGroup)3 TunableInstanceGroup (com.netflix.simianarmy.tunable.TunableInstanceGroup)3 AmazonAutoScaling (com.amazonaws.services.autoscaling.AmazonAutoScaling)2 AmazonAutoScalingClient (com.amazonaws.services.autoscaling.AmazonAutoScalingClient)2 LaunchConfiguration (com.amazonaws.services.autoscaling.model.LaunchConfiguration)2 AWSResource (com.netflix.simianarmy.aws.AWSResource)2 InstanceGroup (com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup)2 Cluster (com.netflix.simianarmy.conformity.Cluster)2 ArrayList (java.util.ArrayList)2