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 testNgativeRetentionDays() {
        new OldEmptyASGRule(new TestMonkeyCalendar(), -1, 60, new DummyASGInstanceValidator());
    }
View Full Code Here


        int retentionDays = 4;

        //set the "now" to the fixed execution date for this rule and create a partial mock
        Calendar fixed = Calendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles"));
        fixed.setTimeInMillis(closeToSpringAheadDst.getMillis());
        MonkeyCalendar monkeyCalendar = new TestMonkeyCalendar();
        MonkeyCalendar spyCalendar = spy(monkeyCalendar);
        when(spyCalendar.now()).thenReturn(fixed);

        //use the partial mock for the OldDetachedVolumeRule
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(spyCalendar, ageThreshold, retentionDays);
View Full Code Here

        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold - 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

        new OldEmptyASGRule(new TestMonkeyCalendar(), -1, 60, new DummyASGInstanceValidator());
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNgativeLaunchConfigAgeThreshold() {
        new OldEmptyASGRule(new TestMonkeyCalendar(), 3, -1, new DummyASGInstanceValidator());
    }
View Full Code Here

                .withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis()));
        ((AWSResource) resource).setAWSResourceState("available");
        String metaTag = VolumeTaggingMonkey.makeMetaTag("i-123", "owner", null);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

        ((AWSResource) resource).setAWSResourceState("available");
        Date lastDetachTime = new Date(now.minusDays(ageThreshold + 1).getMillis());
        String metaTag = VolumeTaggingMonkey.makeMetaTag(null, null, lastDetachTime);
        resource.setTag(JanitorMonkey.JANITOR_META_TAG, metaTag);
        int retentionDays = 4;
        OldDetachedVolumeRule rule = new OldDetachedVolumeRule(new TestMonkeyCalendar(),
                ageThreshold, retentionDays);
        resource.setExpectedTerminationTime(oldTermDate);
        resource.setTerminationReason(oldTermReason);
        Assert.assertFalse(rule.isValid(resource));
        Assert.assertEquals(oldTermDate, resource.getExpectedTerminationTime());
View Full Code Here

    }

    @Test
    public void testNonASGResource() {
        Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE);
        OldEmptyASGRule rule = new OldEmptyASGRule(new TestMonkeyCalendar(), 3, 60, new DummyASGInstanceValidator());
        Assert.assertTrue(rule.isValid(resource));
        Assert.assertNull(resource.getExpectedTerminationTime());
    }
View Full Code Here

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

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

        rule.isValid(null);
    }

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

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

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testNgativeRetentionDaysWithOwner() {
        new OldDetachedVolumeRule(new TestMonkeyCalendar(), 5, -4);
    }
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.