Search in sources :

Example 1 with InstanceGroup

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;
}
Also used : InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup)

Example 2 with InstanceGroup

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));
}
Also used : TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) Test(org.testng.annotations.Test)

Example 3 with InstanceGroup

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");
}
Also used : TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) Test(org.testng.annotations.Test)

Example 4 with InstanceGroup

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));
}
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 5 with InstanceGroup

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");
}
Also used : BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) TagDescription(com.amazonaws.services.autoscaling.model.TagDescription) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) BeforeTest(org.testng.annotations.BeforeTest) Test(org.testng.annotations.Test)

Aggregations

InstanceGroup (com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup)25 Test (org.testng.annotations.Test)21 TestChaosMonkeyContext (com.netflix.simianarmy.chaos.TestChaosMonkeyContext)18 ChaosMonkey (com.netflix.simianarmy.chaos.ChaosMonkey)11 BasicInstanceGroup (com.netflix.simianarmy.basic.chaos.BasicInstanceGroup)4 AutoScalingGroup (com.amazonaws.services.autoscaling.model.AutoScalingGroup)2 TunableInstanceGroup (com.netflix.simianarmy.tunable.TunableInstanceGroup)2 TagDescription (com.amazonaws.services.autoscaling.model.TagDescription)1 Monkey (com.netflix.simianarmy.Monkey)1 MonkeyScheduler (com.netflix.simianarmy.MonkeyScheduler)1 BeforeTest (org.testng.annotations.BeforeTest)1