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;
}
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");
}
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));
}
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);
}
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);
}
Aggregations