use of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar in project SimianArmy by Netflix.
the class TestNoGeneratedAMIRule method testUncompletedVolume.
@Test
public void testUncompletedVolume() {
Resource resource = new AWSResource().withId("snap-12345678901234567").withResourceType(AWSResourceType.EBS_SNAPSHOT);
((AWSResource) resource).setAWSResourceState("stopped");
NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), 0, 0);
Assert.assertTrue(rule.isValid(resource));
Assert.assertNull(resource.getExpectedTerminationTime());
}
use of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar in project SimianArmy by Netflix.
the class TestNoGeneratedAMIRule method testSnapshotsWithoutLauchTime.
@Test
public void testSnapshotsWithoutLauchTime() {
int ageThreshold = 5;
Resource resource = new AWSResource().withId("snap-12345678901234567").withResourceType(AWSResourceType.EBS_SNAPSHOT);
((AWSResource) resource).setAWSResourceState("completed");
int retentionDays = 4;
NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), ageThreshold, retentionDays);
Assert.assertTrue(rule.isValid(resource));
Assert.assertNull(resource.getExpectedTerminationTime());
}
use of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar in project SimianArmy by Netflix.
the class TestNoGeneratedAMIRule method testOldSnapshotWithoutAMI.
@Test
public void testOldSnapshotWithoutAMI() {
int ageThreshold = 5;
DateTime now = DateTime.now();
Resource resource = new AWSResource().withId("snap-12345678901234567").withResourceType(AWSResourceType.EBS_SNAPSHOT).withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
((AWSResource) resource).setAWSResourceState("completed");
int retentionDays = 4;
NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), ageThreshold, retentionDays);
Assert.assertFalse(rule.isValid(resource));
TestUtils.verifyTerminationTimeRough(resource, retentionDays, now);
}
use of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar in project SimianArmy by Netflix.
the class TestNoGeneratedAMIRule method testOldSnapshotWithoutAMIWithoutOwnerOverride.
@Test
public void testOldSnapshotWithoutAMIWithoutOwnerOverride() {
int ageThreshold = 5;
DateTime now = DateTime.now();
Resource resource = new AWSResource().withId("snap-12345678901234567").withOwnerEmail("owner@netflix.com").withResourceType(AWSResourceType.EBS_SNAPSHOT).withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
((AWSResource) resource).setAWSResourceState("completed");
int retentionDays = 4;
NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), ageThreshold, retentionDays);
Assert.assertFalse(rule.isValid(resource));
Assert.assertEquals(resource.getOwnerEmail(), "owner@netflix.com");
TestUtils.verifyTerminationTimeRough(resource, retentionDays, now);
}
use of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar in project SimianArmy by Netflix.
the class TestNoGeneratedAMIRule method testNonSnapshotResource.
@Test
public void testNonSnapshotResource() {
Resource resource = new AWSResource().withId("asg1").withResourceType(AWSResourceType.ASG);
((AWSResource) resource).setAWSResourceState("completed");
NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), 0, 0);
Assert.assertTrue(rule.isValid(resource));
Assert.assertNull(resource.getExpectedTerminationTime());
}
Aggregations