Search in sources :

Example 1 with ChaosMonkey

use of com.netflix.simianarmy.chaos.ChaosMonkey in project SimianArmy by Netflix.

the class TestBasicChaosMonkey method testMandatoryTerminationNotDefined.

@Test
public void testMandatoryTerminationNotDefined() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationNotDefined.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 1);
    Assert.assertEquals(ctx.terminated().size(), 0);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 2 with ChaosMonkey

use of com.netflix.simianarmy.chaos.ChaosMonkey in project SimianArmy by Netflix.

the class TestBasicChaosMonkey method testMaxTerminationCountPerDayAsNegative.

@Test
public void testMaxTerminationCountPerDayAsNegative() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayAsNegative.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 0);
    Assert.assertEquals(ctx.terminated().size(), 0);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 3 with ChaosMonkey

use of com.netflix.simianarmy.chaos.ChaosMonkey in project SimianArmy by Netflix.

the class TestBasicChaosMonkey method testEnabledB.

@Test
public void testEnabledB() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("enabledB.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    List<InstanceGroup> selectedOn = ctx.selectedOn();
    List<String> terminated = ctx.terminated();
    Assert.assertEquals(selectedOn.size(), 2);
    Assert.assertEquals(selectedOn.get(0).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_B);
    Assert.assertEquals(selectedOn.get(0).name(), "name2");
    Assert.assertEquals(selectedOn.get(1).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_B);
    Assert.assertEquals(selectedOn.get(1).name(), "name3");
    Assert.assertEquals(terminated.size(), 0, "nothing terminated");
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) Test(org.testng.annotations.Test)

Example 4 with ChaosMonkey

use of com.netflix.simianarmy.chaos.ChaosMonkey in project SimianArmy by Netflix.

the class TestBasicChaosMonkey method testNotificationEnabled.

@Test
public void testNotificationEnabled() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("notificationEnabled.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 4);
    Assert.assertEquals(ctx.terminated().size(), 4);
    // Notification is enabled only for 2 terminations.
    Assert.assertEquals(ctx.getNotified(), 2);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 5 with ChaosMonkey

use of com.netflix.simianarmy.chaos.ChaosMonkey in project SimianArmy by Netflix.

the class TestBasicChaosMonkey method testDisabled.

@Test
public void testDisabled() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("disabled.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    List<InstanceGroup> selectedOn = ctx.selectedOn();
    List<String> terminated = ctx.terminated();
    Assert.assertEquals(selectedOn.size(), 0, "no groups selected on");
    Assert.assertEquals(terminated.size(), 0, "nothing terminated");
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) Test(org.testng.annotations.Test)

Aggregations

ChaosMonkey (com.netflix.simianarmy.chaos.ChaosMonkey)27 TestChaosMonkeyContext (com.netflix.simianarmy.chaos.TestChaosMonkeyContext)27 Test (org.testng.annotations.Test)27 InstanceGroup (com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup)11 Monkey (com.netflix.simianarmy.Monkey)1 MonkeyScheduler (com.netflix.simianarmy.MonkeyScheduler)1