use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.
the class TestASGChaosCrawler method testFindAggressionCoefficient_unparsable.
@Test
public void testFindAggressionCoefficient_unparsable() {
AutoScalingGroup asg1 = mkAsg("asg1", "i-123456789012345670");
Set<TagDescription> tagDescriptions = new HashSet<>();
tagDescriptions.add(makeTunableTag("not a number"));
asg1.setTags(tagDescriptions);
double aggression = crawler.findAggressionCoefficient(asg1);
Assert.assertEquals(aggression, 1.0);
}
use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.
the class TestASGChaosCrawler method testFindAggressionCoefficient.
@Test
public void testFindAggressionCoefficient() {
AutoScalingGroup asg1 = mkAsg("asg1", "i-123456789012345670");
Set<TagDescription> tagDescriptions = new HashSet<>();
tagDescriptions.add(makeTunableTag("1.0"));
asg1.setTags(tagDescriptions);
double aggression = crawler.findAggressionCoefficient(asg1);
Assert.assertEquals(aggression, 1.0);
}
use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project incubator-gobblin by apache.
the class AWSSdkClient method getAutoScalingGroupsWithTag.
/**
* Get list of {@link AutoScalingGroup}s for a given tag
*
* @param tag Tag to filter the auto scaling groups
* @return List of {@link AutoScalingGroup}s qualifying the filter tag
*/
public List<AutoScalingGroup> getAutoScalingGroupsWithTag(Tag tag) {
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient();
final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest();
final List<AutoScalingGroup> allAutoScalingGroups = autoScaling.describeAutoScalingGroups(describeAutoScalingGroupsRequest).getAutoScalingGroups();
final List<AutoScalingGroup> filteredAutoScalingGroups = Lists.newArrayList();
for (AutoScalingGroup autoScalingGroup : allAutoScalingGroups) {
for (TagDescription tagDescription : autoScalingGroup.getTags()) {
if (tagDescription.getKey().equalsIgnoreCase(tag.getKey()) && tagDescription.getValue().equalsIgnoreCase(tag.getValue())) {
filteredAutoScalingGroups.add(autoScalingGroup);
}
}
}
return filteredAutoScalingGroups;
}
use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.
the class TestASGOwnerEmailTag method testForOwnerTag.
@Test
public void testForOwnerTag() {
Properties properties = new Properties();
BasicConformityMonkeyContext ctx = new BasicConformityMonkeyContext();
List<AutoScalingGroup> asgList = createASGList();
String[] asgNames = { ASG1, ASG2 };
AWSClient awsMock = createMockAWSClient(asgList, asgNames);
Map<String, AWSClient> regionToAwsClient = Maps.newHashMap();
regionToAwsClient.put("us-east-1", awsMock);
AWSClusterCrawler clusterCrawler = new AWSClusterCrawler(regionToAwsClient, new BasicConfiguration(properties));
List<Cluster> clusters = clusterCrawler.clusters(asgNames);
Assert.assertTrue(OWNER_TAG_VALUE.equalsIgnoreCase(clusters.get(0).getOwnerEmail()));
Assert.assertNull(clusters.get(1).getOwnerEmail());
}
use of com.amazonaws.services.autoscaling.model.AutoScalingGroup in project SimianArmy by Netflix.
the class TestASGOwnerEmailTag method makeASG.
private AutoScalingGroup makeASG(String asgName, String ownerEmail) {
TagDescription tag = new TagDescription().withKey(OWNER_TAG_KEY).withValue(ownerEmail);
AutoScalingGroup asg = new AutoScalingGroup().withAutoScalingGroupName(asgName).withTags(tag);
return asg;
}
Aggregations