use of com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup in project SimianArmy by Netflix.
the class CloudFormationChaosMonkey method noSuffixInstanceGroup.
/**
* Return a copy of the instance group removing the randomly generated suffix from
* its name.
*/
public InstanceGroup noSuffixInstanceGroup(InstanceGroup group) {
String newName = group.name().replaceAll("(-)([^-]*$)", "");
InstanceGroup noSuffixGroup = group.copyAs(newName);
return noSuffixGroup;
}
use of com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup in project SimianArmy by Netflix.
the class TestCloudFormationChaosMonkey method testGetEffectiveProbability.
@Test
public void testGetEffectiveProbability() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("cloudformation.properties");
CloudFormationChaosMonkey chaos = new CloudFormationChaosMonkey(ctx);
InstanceGroup group1 = new BasicInstanceGroup("new-group-TestGroup1-XCFNFNFNF", TestChaosMonkeyContext.CrawlerTypes.TYPE_D, "region", Collections.<TagDescription>emptyList());
assertEquals(1.0, chaos.getEffectiveProbability(group1));
}
use of com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup in project SimianArmy by Netflix.
the class TestCloudFormationChaosMonkey method testNoSuffixInstanceGroup.
@Test
public void testNoSuffixInstanceGroup() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("disabled.properties");
CloudFormationChaosMonkey chaos = new CloudFormationChaosMonkey(ctx);
InstanceGroup group = new BasicInstanceGroup("new-group-TestGroup-XCFNFNFNF", TestChaosMonkeyContext.CrawlerTypes.TYPE_D, "region", Collections.<TagDescription>emptyList());
InstanceGroup newGroup = chaos.noSuffixInstanceGroup(group);
assertEquals(newGroup.name(), "new-group-TestGroup");
}
use of com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup 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.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup in project SimianArmy by Netflix.
the class TestFilterASGChaosCrawler method testFilterGroups.
@Test
public void testFilterGroups() {
List<TagDescription> tagList = new ArrayList<TagDescription>();
TagDescription td = new TagDescription();
td.setKey(tagKey);
td.setValue(tagValue);
tagList.add(td);
List<InstanceGroup> listGroup = new LinkedList<InstanceGroup>();
listGroup.add(new BasicInstanceGroup("asg1", Types.ASG, "region1", tagList));
listGroup.add(new BasicInstanceGroup("asg2", Types.ASG, "region2", Collections.<TagDescription>emptyList()));
listGroup.add(new BasicInstanceGroup("asg3", Types.ASG, "region3", tagList));
listGroup.add(new BasicInstanceGroup("asg4", Types.ASG, "region4", Collections.<TagDescription>emptyList()));
when(crawlerMock.groups()).thenReturn(listGroup);
List<InstanceGroup> groups = crawlerMock.groups();
assertEquals(groups.size(), 4);
groups = crawler.groups();
assertEquals(groups.size(), 2);
assertEquals(groups.get(0).name(), "asg1");
assertEquals(groups.get(1).name(), "asg3");
}
Aggregations