Assert.assertEquals(terminated.size(), 0);
}
@Test
public void testFullProbability() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("fullProbability.properties") {
@Override
public MonkeyScheduler scheduler() {
return new MonkeyScheduler() {
@Override
public int frequency() {
return 1;
}
@Override
public TimeUnit frequencyUnit() {
return TimeUnit.DAYS;
}
@Override
public void start(Monkey monkey, Runnable run) {
Assert.assertEquals(monkey.type().name(), monkey.type().name(), "starting monkey");
run.run();
}
@Override
public void stop(Monkey monkey) {
Assert.assertEquals(monkey.type().name(), monkey.type().name(), "stopping monkey");
}
};
}
};
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");