Search in sources :

Example 11 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMandatoryTerminationInsideWindow.

@Test
public void testMandatoryTerminationInsideWindow() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationInsideWindow.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    // The last opt-in time is within the window, so no mandatory termination is triggered
    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 12 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMaxTerminationCountPerDayAsBiggerThanOne.

@Test
public void testMaxTerminationCountPerDayAsBiggerThanOne() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayAsBiggerThanOne.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 1);
    Assert.assertEquals(ctx.terminated().size(), 1);
    // Run the chaos the second time will trigger another termination
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 2);
    Assert.assertEquals(ctx.terminated().size(), 2);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 13 with ChaosMonkey

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

the class TestBasicChaosMonkey method testEnabledAwithout1.

@Test
public void testEnabledAwithout1() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("enabledAwithout1.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    List<InstanceGroup> selectedOn = ctx.selectedOn();
    List<String> terminated = ctx.terminated();
    Assert.assertEquals(selectedOn.size(), 1);
    Assert.assertEquals(selectedOn.get(0).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_A);
    Assert.assertEquals(selectedOn.get(0).name(), "name0");
    Assert.assertEquals(terminated.size(), 1);
    Assert.assertEquals(terminated.get(0), "0:i-123456789012345670");
}
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 14 with ChaosMonkey

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

the class TestBasicChaosMonkey method testEnabledAwith0.

@Test
public void testEnabledAwith0() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("enabledAwith0.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    List<InstanceGroup> selectedOn = ctx.selectedOn();
    List<String> terminated = ctx.terminated();
    Assert.assertEquals(selectedOn.size(), 1);
    Assert.assertEquals(selectedOn.get(0).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_A);
    Assert.assertEquals(selectedOn.get(0).name(), "name0");
    Assert.assertEquals(terminated.size(), 1);
    Assert.assertEquals(terminated.get(0), "0:i-123456789012345670");
}
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 15 with ChaosMonkey

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

the class TestBasicChaosMonkey method testGlobalNotificationEnabled.

@Test
public void testGlobalNotificationEnabled() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("globalNotificationEnabled.properties");
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    Assert.assertEquals(ctx.selectedOn().size(), 4);
    Assert.assertEquals(ctx.terminated().size(), 4);
    Assert.assertEquals(ctx.getNotified(), 1);
    Assert.assertEquals(ctx.getGloballyNotified(), 4);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) 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