From 4a948c14879d7205c8f733447665d77e441d8bb4 Mon Sep 17 00:00:00 2001 From: Nir Alfasi Date: Fri, 29 Aug 2014 13:53:14 -0700 Subject: [PATCH] The original condition should be returned in addition to the new one since unit-test will otherwise fail: the reason for that is that the unit-test checks two things: 1. selected instances 2. terminated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and no instance should be selected if we reached the max. Though the previous fix ensures that we won’t kill the chosen instance - according to the unit-test we should not even choose it (strict approach). --- .../com/netflix/simianarmy/basic/chaos/BasicChaosMonkey.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/netflix/simianarmy/basic/chaos/BasicChaosMonkey.java b/src/main/java/com/netflix/simianarmy/basic/chaos/BasicChaosMonkey.java index be86373a..bb4a1f86 100644 --- a/src/main/java/com/netflix/simianarmy/basic/chaos/BasicChaosMonkey.java +++ b/src/main/java/com/netflix/simianarmy/basic/chaos/BasicChaosMonkey.java @@ -109,6 +109,9 @@ public void doMonkeyBusiness() { } for (InstanceGroup group : context().chaosCrawler().groups()) { if (isGroupEnabled(group)) { + if (isMaxTerminationCountExceeded(group)) { + continue; + } double prob = getEffectiveProbability(group); Collection instances = context().chaosInstanceSelector().select(group, prob / runsPerDay); for (String inst : instances) {