Package com.netflix.simianarmy.aws.janitor.rule

Examples of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar


        Assert.assertEquals(oldTermReason, resource.getTerminationReason());
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNullResource() {
        NoGeneratedAMIRule rule = new NoGeneratedAMIRule(new TestMonkeyCalendar(), 5, 4);
        rule.isValid(null);
    }
View Full Code Here


        rule.isValid(null);
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNgativeAgeThreshold() {
        new NoGeneratedAMIRule(new TestMonkeyCalendar(), -1, 4);
    }
View Full Code Here

        new NoGeneratedAMIRule(new TestMonkeyCalendar(), -1, 4);
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNgativeRetentionDaysWithOwner() {
        new NoGeneratedAMIRule(new TestMonkeyCalendar(), 5, -4);
    }
View Full Code Here

                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()))
                .withOwnerEmail("owner@foo.com");
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertFalse(rule.isValid(resource));
        TestUtils.verifyTerminationTimeRough(resource, retentionDaysWithOwner, now);
    }
View Full Code Here

        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE)
                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertFalse(rule.isValid(resource));
        TestUtils.verifyTerminationTimeRough(resource, retentionDaysWithoutOwner, now);
    }
View Full Code Here

        int ageThreshold = 5;
        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE);
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE)
                .withLaunchTime(new Date(now.minusDays(ageThreshold - 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE)
                .setAdditionalField(InstanceJanitorCrawler.INSTANCE_FIELD_ASG_NAME, "asg1");
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

                .withExpectedTerminationTime(oldTermDate)
                .withTerminationReason(oldTermReason);
        ((AWSResource) resource).setAWSResourceState("running");
        int retentionDaysWithOwner = 4;
        int retentionDaysWithoutOwner = 8;
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDaysWithOwner, retentionDaysWithoutOwner);
        Assert.assertFalse(rule.isValid(resource));
        Assert.assertEquals(oldTermDate, resource.getExpectedTerminationTime());
        Assert.assertEquals(oldTermReason, resource.getTerminationReason());
    }
View Full Code Here

        Assert.assertEquals(oldTermReason, resource.getTerminationReason());
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNullResource() {
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(), 5, 4, 8);
        rule.isValid(null);
    }
View Full Code Here

TOP

Related Classes of com.netflix.simianarmy.aws.janitor.rule.TestMonkeyCalendar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.