use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testMaxTerminationCountPerDayGroupLevel.
@Test
public void testMaxTerminationCountPerDayGroupLevel() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayGroupLevel.properties");
ChaosMonkey chaos = new BasicChaosMonkey(ctx);
for (int i = 1; i <= 3; i++) {
chaos.start();
chaos.stop();
Assert.assertEquals(ctx.selectedOn().size(), i);
Assert.assertEquals(ctx.terminated().size(), i);
}
// Run the chaos the second time will NOT trigger another termination
chaos.start();
chaos.stop();
Assert.assertEquals(ctx.selectedOn().size(), 3);
Assert.assertEquals(ctx.terminated().size(), 3);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testMandatoryTerminationDisabled.
@Test
public void testMandatoryTerminationDisabled() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationDisabled.properties");
ChaosMonkey chaos = new BasicChaosMonkey(ctx);
chaos.start();
chaos.stop();
Assert.assertEquals(ctx.selectedOn().size(), 1);
Assert.assertEquals(ctx.terminated().size(), 0);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testMandatoryTerminationOutsideWindow.
@Test
public void testMandatoryTerminationOutsideWindow() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationOutsideWindow.properties");
ChaosMonkey chaos = new BasicChaosMonkey(ctx);
chaos.start();
chaos.stop();
// There was no termination in the last window, so one mandatory termination is triggered
Assert.assertEquals(ctx.selectedOn().size(), 1);
Assert.assertEquals(ctx.terminated().size(), 1);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testAll.
@Test
public void testAll() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("all.properties");
ChaosMonkey chaos = new BasicChaosMonkey(ctx);
chaos.start();
chaos.stop();
List<InstanceGroup> selectedOn = ctx.selectedOn();
List<String> terminated = ctx.terminated();
Assert.assertEquals(selectedOn.size(), 4);
Assert.assertEquals(selectedOn.get(0).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_A);
Assert.assertEquals(selectedOn.get(0).name(), "name0");
Assert.assertEquals(selectedOn.get(1).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_A);
Assert.assertEquals(selectedOn.get(1).name(), "name1");
Assert.assertEquals(selectedOn.get(2).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_B);
Assert.assertEquals(selectedOn.get(2).name(), "name2");
Assert.assertEquals(selectedOn.get(3).type(), TestChaosMonkeyContext.CrawlerTypes.TYPE_B);
Assert.assertEquals(selectedOn.get(3).name(), "name3");
Assert.assertEquals(terminated.size(), 4);
Assert.assertEquals(terminated.get(0), "0:i-123456789012345670");
Assert.assertEquals(terminated.get(1), "1:i-123456789012345671");
Assert.assertEquals(terminated.get(2), "2:i-123456789012345672");
Assert.assertEquals(terminated.get(3), "3:i-123456789012345673");
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testMaxTerminationCountPerDayAsOne.
@Test
public void testMaxTerminationCountPerDayAsOne() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayAsOne.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 NOT trigger another termination
chaos.start();
chaos.stop();
Assert.assertEquals(ctx.selectedOn().size(), 1);
Assert.assertEquals(ctx.terminated().size(), 1);
}
Aggregations