use of com.netflix.simianarmy.basic.chaos.BasicInstanceGroup in project SimianArmy by Netflix.
the class ASGChaosCrawler method getInstanceGroup.
/**
* Returns the desired InstanceGroup. If there is no set aggression coefficient, then it
* returns the basic impl, otherwise it returns the tunable impl.
* @param asg The autoscaling group
* @return The appropriate {@link InstanceGroup}
*/
protected InstanceGroup getInstanceGroup(AutoScalingGroup asg, double aggressionCoefficient) {
InstanceGroup instanceGroup;
// if coefficient is 1 then the BasicInstanceGroup is fine, otherwise use Tunable
if (aggressionCoefficient == 1.0) {
instanceGroup = new BasicInstanceGroup(asg.getAutoScalingGroupName(), Types.ASG, awsClient.region(), asg.getTags());
} else {
TunableInstanceGroup tunable = new TunableInstanceGroup(asg.getAutoScalingGroupName(), Types.ASG, awsClient.region(), asg.getTags());
tunable.setAggressionCoefficient(aggressionCoefficient);
instanceGroup = tunable;
}
return instanceGroup;
}
use of com.netflix.simianarmy.basic.chaos.BasicInstanceGroup in project SimianArmy by Netflix.
the class TestFilterASGChaosCrawler method testFilterGroups.
@Test
public void testFilterGroups() {
List<TagDescription> tagList = new ArrayList<TagDescription>();
TagDescription td = new TagDescription();
td.setKey(tagKey);
td.setValue(tagValue);
tagList.add(td);
List<InstanceGroup> listGroup = new LinkedList<InstanceGroup>();
listGroup.add(new BasicInstanceGroup("asg1", Types.ASG, "region1", tagList));
listGroup.add(new BasicInstanceGroup("asg2", Types.ASG, "region2", Collections.<TagDescription>emptyList()));
listGroup.add(new BasicInstanceGroup("asg3", Types.ASG, "region3", tagList));
listGroup.add(new BasicInstanceGroup("asg4", Types.ASG, "region4", Collections.<TagDescription>emptyList()));
when(crawlerMock.groups()).thenReturn(listGroup);
List<InstanceGroup> groups = crawlerMock.groups();
assertEquals(groups.size(), 4);
groups = crawler.groups();
assertEquals(groups.size(), 2);
assertEquals(groups.get(0).name(), "asg1");
assertEquals(groups.get(1).name(), "asg3");
}
use of com.netflix.simianarmy.basic.chaos.BasicInstanceGroup in project SimianArmy by Netflix.
the class TestASGChaosCrawler method testGetInstanceGroup_basic.
@Test
public void testGetInstanceGroup_basic() {
AutoScalingGroup asg = mkAsg("asg1", "i-123456789012345670");
InstanceGroup group = crawler.getInstanceGroup(asg, 1.0);
Assert.assertTrue((group instanceof BasicInstanceGroup));
Assert.assertFalse((group instanceof TunableInstanceGroup));
}
use of com.netflix.simianarmy.basic.chaos.BasicInstanceGroup in project SimianArmy by Netflix.
the class TestTunablyAggressiveChaosMonkey method testFullProbability_basic.
@Test
public void testFullProbability_basic() {
TestChaosMonkeyContext ctx = new TestChaosMonkeyContext("fullProbability.properties");
TunablyAggressiveChaosMonkey chaos = new TunablyAggressiveChaosMonkey(ctx);
InstanceGroup basic = new BasicInstanceGroup("basic", GroupTypes.TYPE_A, "region", Collections.<TagDescription>emptyList());
double probability = chaos.getEffectiveProbability(basic);
Assert.assertEquals(probability, 1.0);
}
Aggregations