Search in sources :

Example 1 with TunableInstanceGroup

use of com.netflix.simianarmy.tunable.TunableInstanceGroup 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;
}
Also used : TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup)

Example 2 with TunableInstanceGroup

use of com.netflix.simianarmy.tunable.TunableInstanceGroup in project SimianArmy by Netflix.

the class TestASGChaosCrawler method testGetInstanceGroup_tunable.

@Test
public void testGetInstanceGroup_tunable() {
    AutoScalingGroup asg = mkAsg("asg1", "i-123456789012345670");
    InstanceGroup group = crawler.getInstanceGroup(asg, 2.0);
    Assert.assertTrue((group instanceof TunableInstanceGroup));
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) Test(org.testng.annotations.Test)

Example 3 with TunableInstanceGroup

use of com.netflix.simianarmy.tunable.TunableInstanceGroup 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));
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) InstanceGroup(com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup) TunableInstanceGroup(com.netflix.simianarmy.tunable.TunableInstanceGroup) BasicInstanceGroup(com.netflix.simianarmy.basic.chaos.BasicInstanceGroup) Test(org.testng.annotations.Test)

Aggregations

BasicInstanceGroup (com.netflix.simianarmy.basic.chaos.BasicInstanceGroup)3 TunableInstanceGroup (com.netflix.simianarmy.tunable.TunableInstanceGroup)3 AutoScalingGroup (com.amazonaws.services.autoscaling.model.AutoScalingGroup)2 InstanceGroup (com.netflix.simianarmy.chaos.ChaosCrawler.InstanceGroup)2 Test (org.testng.annotations.Test)2