use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext 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);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext 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");
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext 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);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext in project SimianArmy by Netflix.
the class TestBasicChaosMonkey method testGetValueFromCfgWithDefault.
@Test
public void testGetValueFromCfgWithDefault() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("propertiesWithDefaults.properties");
BasicChaosMonkey chaos = new BasicChaosMonkey(ctx);
// named 1 has actual values in config
InstanceGroup named1 = new BasicInstanceGroup("named1", GroupTypes.TYPE_A, "test-dev-1", Collections.<TagDescription>emptyList());
// named 2 doesn't have values but it's group has values
InstanceGroup named2 = new BasicInstanceGroup("named2", GroupTypes.TYPE_A, "test-dev-1", Collections.<TagDescription>emptyList());
// named 3 doesn't have values and it's group doesn't have values
InstanceGroup named3 = new BasicInstanceGroup("named3", GroupTypes.TYPE_B, "test-dev-1", Collections.<TagDescription>emptyList());
Assert.assertEquals(chaos.getBoolFromCfgOrDefault(named1, "enabled", true), false);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named1, "probability", 3.0), 1.1);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named1, "maxTerminationsPerDay", 4.0), 2.1);
Assert.assertEquals(chaos.getBoolFromCfgOrDefault(named2, "enabled", true), true);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named2, "probability", 3.0), 1.0);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named2, "maxTerminationsPerDay", 4.0), 2.0);
Assert.assertEquals(chaos.getBoolFromCfgOrDefault(named3, "enabled", true), true);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named3, "probability", 3.0), 3.0);
Assert.assertEquals(chaos.getNumFromCfgOrDefault(named3, "maxTerminationsPerDay", 4.0), 4.0);
}
use of com.netflix.simianarmy.chaos.TestChaosMonkeyContext 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);
}
Aggregations