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

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


        rule.isValid(null);
    }

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


        new OrphanedInstanceRule(new TestMonkeyCalendar(), -1, 4, 8);
    }

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

        new OrphanedInstanceRule(new TestMonkeyCalendar(), 5, -4, 8);
    }

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

    @Test
    public void testNonInstanceResource() {
        Resource resource = new AWSResource().withId("asg1").withResourceType(AWSResourceType.ASG);
        ((AWSResource) resource).setAWSResourceState("running");
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(), 0, 0, 0);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

    @Test
    public void testNonRunningInstance() {
        Resource resource = new AWSResource().withId("i-123").withResourceType(AWSResourceType.INSTANCE);
        ((AWSResource) resource).setAWSResourceState("stopping");
        OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(), 0, 0, 0);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

    @Test
    public void testOldUnsedLaunchConfig() {
        Resource resource = new AWSResource().withId("launchConfig1").withResourceType(AWSResourceType.LAUNCH_CONFIG);
        resource.setAdditionalField(LaunchConfigJanitorCrawler.LAUNCH_CONFIG_FIELD_USED_BY_ASG, "false");
        MonkeyCalendar calendar = new TestMonkeyCalendar();
        int ageThreshold = 3;
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        resource.setLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        int retentionDays = 3;
        OldUnusedLaunchConfigRule rule = new OldUnusedLaunchConfigRule(calendar, ageThreshold, retentionDays);
        Assert.assertFalse(rule.isValid(resource));
        TestUtils.verifyTerminationTimeRough(resource, retentionDays, now);
View Full Code Here

    }

    @Test
    public void testOldLaunchConfigWithNullFlag() {
        Resource resource = new AWSResource().withId("launchConfig1").withResourceType(AWSResourceType.LAUNCH_CONFIG);
        MonkeyCalendar calendar = new TestMonkeyCalendar();
        int ageThreshold = 3;
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        resource.setLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        int retentionDays = 3;
        OldUnusedLaunchConfigRule rule = new OldUnusedLaunchConfigRule(calendar, ageThreshold, retentionDays);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
View Full Code Here

    @Test
    public void testUnsedLaunchConfigNotOld() {
        Resource resource = new AWSResource().withId("launchConfig1").withResourceType(AWSResourceType.LAUNCH_CONFIG);
        resource.setAdditionalField(LaunchConfigJanitorCrawler.LAUNCH_CONFIG_FIELD_USED_BY_ASG, "false");
        MonkeyCalendar calendar = new TestMonkeyCalendar();
        int ageThreshold = 3;
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        resource.setLaunchTime(new Date(now.minusDays(ageThreshold - 1).getMillis()));
        int retentionDays = 3;
        OldUnusedLaunchConfigRule rule = new OldUnusedLaunchConfigRule(calendar, ageThreshold, retentionDays);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
View Full Code Here

    public void testEmptyASGWithObsoleteLaunchConfig() {
        Resource resource = new AWSResource().withId("asg1").withResourceType(AWSResourceType.ASG);
        resource.setAdditionalField(ASGJanitorCrawler.ASG_FIELD_LC_NAME, "launchConfig");
        resource.setAdditionalField(ASGJanitorCrawler.ASG_FIELD_MAX_SIZE, "0");
        int launchConfiguAgeThreshold = 60;
        MonkeyCalendar calendar = new TestMonkeyCalendar();
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        resource.setAdditionalField(ASGJanitorCrawler.ASG_FIELD_LC_CREATION_TIME,
                String.valueOf(now.minusDays(launchConfiguAgeThreshold + 1).getMillis()));
        int retentionDays = 3;
        OldEmptyASGRule rule = new OldEmptyASGRule(calendar, launchConfiguAgeThreshold, retentionDays,
                new DummyASGInstanceValidator());
View Full Code Here

    @Test
    public void testUsedLaunchConfig() {
        Resource resource = new AWSResource().withId("launchConfig1").withResourceType(AWSResourceType.LAUNCH_CONFIG);
        resource.setAdditionalField(LaunchConfigJanitorCrawler.LAUNCH_CONFIG_FIELD_USED_BY_ASG, "true");
        MonkeyCalendar calendar = new TestMonkeyCalendar();
        int ageThreshold = 3;
        DateTime now = new DateTime(calendar.now().getTimeInMillis());
        resource.setLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        int retentionDays = 3;
        OldUnusedLaunchConfigRule rule = new OldUnusedLaunchConfigRule(calendar, ageThreshold, retentionDays);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
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.