Search in sources :

Example 26 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMandatoryTerminationInsideWindowWithPreviousTermination.

@Test
public void testMandatoryTerminationInsideWindowWithPreviousTermination() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationInsideWindow.properties");
    terminateOnDemand(ctx, "TYPE_C", "name4");
    Assert.assertEquals(ctx.selectedOn().size(), 1);
    Assert.assertEquals(ctx.terminated().size(), 1);
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    // There was termination in the last window, so no mandatory termination is triggered
    Assert.assertEquals(ctx.selectedOn().size(), 2);
    Assert.assertEquals(ctx.terminated().size(), 1);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 27 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMandatoryTerminationOutsideWindowWithPreviousTermination.

@Test
public void testMandatoryTerminationOutsideWindowWithPreviousTermination() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationOutsideWindow.properties");
    terminateOnDemand(ctx, "TYPE_C", "name4");
    Assert.assertEquals(ctx.selectedOn().size(), 1);
    Assert.assertEquals(ctx.terminated().size(), 1);
    ChaosMonkey chaos = new BasicChaosMonkey(ctx);
    chaos.start();
    chaos.stop();
    // There was termination in the last window, so no mandatory termination is triggered
    Assert.assertEquals(ctx.selectedOn().size(), 2);
    Assert.assertEquals(ctx.terminated().size(), 1);
}
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