Search in sources :

Example 26 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestSimpleDBRecorder method makeMockAWSClient.

private static AWSClient makeMockAWSClient() {
    AmazonSimpleDB sdbMock = mock(AmazonSimpleDB.class);
    AWSClient awsClient = mock(AWSClient.class);
    when(awsClient.sdbClient()).thenReturn(sdbMock);
    when(awsClient.region()).thenReturn("region");
    return awsClient;
}
Also used : AmazonSimpleDB(com.amazonaws.services.simpledb.AmazonSimpleDB) AWSClient(com.netflix.simianarmy.client.aws.AWSClient)

Example 27 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method testInstancesWithNullNames.

@Test
public void testInstancesWithNullNames() {
    List<AutoScalingGroup> asgList = createASGList();
    AWSClient awsMock = createMockAWSClient(asgList);
    ASGJanitorCrawler crawler = new ASGJanitorCrawler(awsMock);
    List<Resource> resources = crawler.resources();
    verifyASGList(resources, asgList);
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) Resource(com.netflix.simianarmy.Resource) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) Test(org.testng.annotations.Test)

Example 28 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGJanitorCrawler method createMockAWSClient.

private AWSClient createMockAWSClient(List<AutoScalingGroup> asgList, String... asgNames) {
    AWSClient awsMock = mock(AWSClient.class);
    when(awsMock.describeAutoScalingGroups(asgNames)).thenReturn(asgList);
    when(awsMock.region()).thenReturn("us-east-1");
    return awsMock;
}
Also used : AWSClient(com.netflix.simianarmy.client.aws.AWSClient)

Example 29 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGOwnerEmailTag method createMockAWSClient.

private AWSClient createMockAWSClient(List<AutoScalingGroup> asgList, String... asgNames) {
    AWSClient awsMock = mock(AWSClient.class);
    when(awsMock.describeAutoScalingGroups(asgNames)).thenReturn(asgList);
    return awsMock;
}
Also used : AWSClient(com.netflix.simianarmy.client.aws.AWSClient)

Example 30 with AWSClient

use of com.netflix.simianarmy.client.aws.AWSClient in project SimianArmy by Netflix.

the class TestASGOwnerEmailTag method testForOwnerTag.

@Test
public void testForOwnerTag() {
    Properties properties = new Properties();
    BasicConformityMonkeyContext ctx = new BasicConformityMonkeyContext();
    List<AutoScalingGroup> asgList = createASGList();
    String[] asgNames = { ASG1, ASG2 };
    AWSClient awsMock = createMockAWSClient(asgList, asgNames);
    Map<String, AWSClient> regionToAwsClient = Maps.newHashMap();
    regionToAwsClient.put("us-east-1", awsMock);
    AWSClusterCrawler clusterCrawler = new AWSClusterCrawler(regionToAwsClient, new BasicConfiguration(properties));
    List<Cluster> clusters = clusterCrawler.clusters(asgNames);
    Assert.assertTrue(OWNER_TAG_VALUE.equalsIgnoreCase(clusters.get(0).getOwnerEmail()));
    Assert.assertNull(clusters.get(1).getOwnerEmail());
}
Also used : AutoScalingGroup(com.amazonaws.services.autoscaling.model.AutoScalingGroup) BasicConformityMonkeyContext(com.netflix.simianarmy.basic.conformity.BasicConformityMonkeyContext) Cluster(com.netflix.simianarmy.conformity.Cluster) AWSClient(com.netflix.simianarmy.client.aws.AWSClient) AWSClusterCrawler(com.netflix.simianarmy.aws.conformity.crawler.AWSClusterCrawler) Properties(java.util.Properties) BasicConfiguration(com.netflix.simianarmy.basic.BasicConfiguration) Test(org.testng.annotations.Test)

Aggregations

AWSClient (com.netflix.simianarmy.client.aws.AWSClient)37 Resource (com.netflix.simianarmy.Resource)18 Test (org.testng.annotations.Test)15 AutoScalingGroup (com.amazonaws.services.autoscaling.model.AutoScalingGroup)11 AWSResource (com.netflix.simianarmy.aws.AWSResource)10 Instance (com.amazonaws.services.ec2.model.Instance)7 LoadBalancerDescription (com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription)6 AutoScalingInstanceDetails (com.amazonaws.services.autoscaling.model.AutoScalingInstanceDetails)5 LinkedList (java.util.LinkedList)4 Tag (com.amazonaws.services.ec2.model.Tag)3 Instance (com.amazonaws.services.autoscaling.model.Instance)2 LaunchConfiguration (com.amazonaws.services.autoscaling.model.LaunchConfiguration)2 SuspendedProcess (com.amazonaws.services.autoscaling.model.SuspendedProcess)2 TagDescription (com.amazonaws.services.autoscaling.model.TagDescription)2 AmazonSimpleDB (com.amazonaws.services.simpledb.AmazonSimpleDB)2 AWSResourceType (com.netflix.simianarmy.aws.AWSResourceType)2 Cluster (com.netflix.simianarmy.conformity.Cluster)2 GroupIdentifier (com.amazonaws.services.ec2.model.GroupIdentifier)1 Snapshot (com.amazonaws.services.ec2.model.Snapshot)1 Volume (com.amazonaws.services.ec2.model.Volume)1