Search in sources :

Example 6 with ChaosMonkey

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

the class TestBasicChaosMonkey method testNoProbabilityByName.

@Test
public void testNoProbabilityByName() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("noProbabilityByName.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(), 0);
}
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 7 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMaxTerminationCountPerDayAsVerySmall.

@Test
public void testMaxTerminationCountPerDayAsVerySmall() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayAsVerySmall.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 8 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMandatoryTerminationNoOptInTime.

@Test
public void testMandatoryTerminationNoOptInTime() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("mandatoryTerminationNoOptInTime.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 9 with ChaosMonkey

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

the class TestBasicChaosMonkey method testMaxTerminationCountPerDayAsSmallerThanOne.

@Test
public void testMaxTerminationCountPerDayAsSmallerThanOne() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("terminationPerDayAsSmallerThanOne.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);
}
Also used : ChaosMonkey(com.netflix.simianarmy.chaos.ChaosMonkey) TestChaosMonkeyContext(com.netflix.simianarmy.chaos.TestChaosMonkeyContext) Test(org.testng.annotations.Test)

Example 10 with ChaosMonkey

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

the class TestBasicChaosMonkey method testEnabledA.

@Test
public void testEnabledA() {
    TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("enabledA.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_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(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