Search in sources :

Example 16 with AutoScalingGroup

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

the class TestAWSClient method mkAsgResult.

private DescribeAutoScalingGroupsResult mkAsgResult(String asgName, String instanceId) {
    DescribeAutoScalingGroupsResult result = new DescribeAutoScalingGroupsResult();
    AutoScalingGroup asg = new AutoScalingGroup();
    asg.setAutoScalingGroupName(asgName);
    Instance inst = new Instance();
    inst.setInstanceId(instanceId);
    asg.setInstances(Arrays.asList(inst));
    result.setAutoScalingGroups(Arrays.asList(asg));
    return result;
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Instance(com.amazonaws.services.autoscaling.model.Instance) DescribeAutoScalingGroupsResult(com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsResult)

Example 17 with AutoScalingGroup

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

the class TestAWSClient method testDescribeAutoScalingGroups.

@Test
public void testDescribeAutoScalingGroups() {
    DescribeAutoScalingGroupsResult result1 = mkAsgResult("asg1", "i-123456789012345670");
    result1.setNextToken("nextToken");
    DescribeAutoScalingGroupsResult result2 = mkAsgResult("asg2", "i-123456789012345671");
    when(asgMock.describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class))).thenReturn(result1).thenReturn(result2);
    List<AutoScalingGroup> asgs = this.describeAutoScalingGroups();
    verify(asgMock, times(2)).describeAutoScalingGroups(any(DescribeAutoScalingGroupsRequest.class));
    Assert.assertEquals(asgs.size(), 2);
    // 2 asgs with 1 instance each
    Assert.assertEquals(asgs.get(0).getAutoScalingGroupName(), "asg1");
    Assert.assertEquals(asgs.get(0).getInstances().size(), 1);
    Assert.assertEquals(asgs.get(0).getInstances().get(0).getInstanceId(), "i-123456789012345670");
    Assert.assertEquals(asgs.get(1).getAutoScalingGroupName(), "asg2");
    Assert.assertEquals(asgs.get(1).getInstances().size(), 1);
    Assert.assertEquals(asgs.get(1).getInstances().get(0).getInstanceId(), "i-123456789012345671");
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) DescribeAutoScalingGroupsRequest(com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsRequest) DescribeAutoScalingGroupsResult(com.amazonaws.services.autoscaling.model.DescribeAutoScalingGroupsResult) Test(org.testng.annotations.Test)

Example 18 with AutoScalingGroup

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

the class TestASGChaosCrawler method testGetInstanceGroup_tunable.

@Test
public void testGetInstanceGroup_tunable() {
    AutoScalingGroup asg = mkAsg("asg1", "i-123456789012345670");
    InstanceGroup group = crawler.getInstanceGroup(asg, 2.0);
    Assert.assertTrue((group instanceof TunableInstanceGroup));
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) Test(org.testng.annotations.Test)

Example 19 with AutoScalingGroup

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

the class TestASGChaosCrawler method testFindAggressionCoefficient_two.

@Test
public void testFindAggressionCoefficient_two() {
    AutoScalingGroup asg1 = mkAsg("asg1", "i-123456789012345670");
    Set<TagDescription> tagDescriptions = new HashSet<>();
    tagDescriptions.add(makeTunableTag("2.0"));
    asg1.setTags(tagDescriptions);
    double aggression = crawler.findAggressionCoefficient(asg1);
    Assert.assertEquals(aggression, 2.0);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) TagDescription(com.amazonaws.services.autoscaling.model.TagDescription) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 20 with AutoScalingGroup

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

the class TestASGChaosCrawler method testFindAggressionCoefficient_null.

@Test
public void testFindAggressionCoefficient_null() {
    AutoScalingGroup asg1 = mkAsg("asg1", "i-123456789012345670");
    Set<TagDescription> tagDescriptions = new HashSet<>();
    tagDescriptions.add(makeTunableTag(null));
    asg1.setTags(tagDescriptions);
    double aggression = crawler.findAggressionCoefficient(asg1);
    Assert.assertEquals(aggression, 1.0);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) TagDescription(com.amazonaws.services.autoscaling.model.TagDescription) HashSet(java.util.HashSet) 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