This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from ebukoski/master
Update tests for AWS 17 characters resources
- Loading branch information
Showing
22 changed files
with
107 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ public class TestUntaggedRule { | |
@Test | ||
public void testUntaggedInstanceWithOwner() { | ||
DateTime now = DateTime.now(); | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withOwnerEmail("[email protected]"); | ||
resource.setTag("tag1", "value1"); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
|
@@ -57,7 +57,7 @@ public void testUntaggedInstanceWithOwner() { | |
@Test | ||
public void testUntaggedInstanceWithoutOwner() { | ||
DateTime now = DateTime.now(); | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE); | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE); | ||
resource.setTag("tag1", "value1"); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
Set<String> tags = new HashSet<String>(); | ||
|
@@ -72,7 +72,7 @@ public void testUntaggedInstanceWithoutOwner() { | |
|
||
@Test | ||
public void testTaggedInstance() { | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE); | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE); | ||
resource.setTag("tag1", "value1"); | ||
resource.setTag("tag2", "value2"); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
|
@@ -90,7 +90,7 @@ public void testUntaggedResource() { | |
DateTime now = DateTime.now(); | ||
Resource imageResource = new AWSResource().withId("ami-123123").withResourceType(AWSResourceType.IMAGE); | ||
Resource asgResource = new AWSResource().withId("my-cool-asg").withResourceType(AWSResourceType.ASG); | ||
Resource ebsSnapshotResource = new AWSResource().withId("snap-123123").withResourceType(AWSResourceType.EBS_SNAPSHOT); | ||
Resource ebsSnapshotResource = new AWSResource().withId("snap-12345678901234567").withResourceType(AWSResourceType.EBS_SNAPSHOT); | ||
Resource lauchConfigurationResource = new AWSResource().withId("my-cool-launch-configuration").withResourceType(AWSResourceType.LAUNCH_CONFIG); | ||
Set<String> tags = new HashSet<String>(); | ||
tags.add("tag1"); | ||
|
@@ -113,7 +113,7 @@ public void testResourceWithExpectedTerminationTimeSet() { | |
DateTime now = DateTime.now(); | ||
Date oldTermDate = new Date(now.plusDays(10).getMillis()); | ||
String oldTermReason = "Foo"; | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withExpectedTerminationTime(oldTermDate) | ||
.withTerminationReason(oldTermReason); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ public class TestOrphanedInstanceRule { | |
public void testOrphanedInstancesWithOwner() { | ||
int ageThreshold = 5; | ||
DateTime now = DateTime.now(); | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis())) | ||
.withOwnerEmail("[email protected]"); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
|
@@ -55,7 +55,7 @@ public void testOrphanedInstancesWithOwner() { | |
public void testOrphanedInstancesWithoutOwner() { | ||
int ageThreshold = 5; | ||
DateTime now = DateTime.now(); | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis())); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
int retentionDaysWithOwner = 4; | ||
|
@@ -69,7 +69,7 @@ public void testOrphanedInstancesWithoutOwner() { | |
@Test | ||
public void testOrphanedInstancesWithoutLaunchTime() { | ||
int ageThreshold = 5; | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE); | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
int retentionDaysWithOwner = 4; | ||
int retentionDaysWithoutOwner = 8; | ||
|
@@ -83,7 +83,7 @@ public void testOrphanedInstancesWithoutLaunchTime() { | |
public void testOrphanedInstancesWithLaunchTimeNotExpires() { | ||
int ageThreshold = 5; | ||
DateTime now = DateTime.now(); | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withLaunchTime(new Date(now.minusDays(ageThreshold - 1).getMillis())); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
int retentionDaysWithOwner = 4; | ||
|
@@ -97,7 +97,7 @@ public void testOrphanedInstancesWithLaunchTimeNotExpires() { | |
@Test | ||
public void testNonOrphanedInstances() { | ||
int ageThreshold = 5; | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.setAdditionalField(InstanceJanitorCrawler.INSTANCE_FIELD_ASG_NAME, "asg1"); | ||
((AWSResource) resource).setAWSResourceState("running"); | ||
int retentionDaysWithOwner = 4; | ||
|
@@ -114,7 +114,7 @@ public void testResourceWithExpectedTerminationTimeSet() { | |
Date oldTermDate = new Date(now.plusDays(10).getMillis()); | ||
String oldTermReason = "Foo"; | ||
int ageThreshold = 5; | ||
Resource resource = new AWSResource().withId("i-12345678").withResourceType(AWSResourceType.INSTANCE) | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE) | ||
.withLaunchTime(new Date(now.minusDays(ageThreshold + 1).getMillis())) | ||
.withExpectedTerminationTime(oldTermDate) | ||
.withTerminationReason(oldTermReason); | ||
|
@@ -165,7 +165,7 @@ public void testNonInstanceResource() { | |
|
||
@Test | ||
public void testNonRunningInstance() { | ||
Resource resource = new AWSResource().withId("i-123").withResourceType(AWSResourceType.INSTANCE); | ||
Resource resource = new AWSResource().withId("i-12345678901234567").withResourceType(AWSResourceType.INSTANCE); | ||
((AWSResource) resource).setAWSResourceState("stopping"); | ||
OrphanedInstanceRule rule = new OrphanedInstanceRule(new TestMonkeyCalendar(), 0, 0, 0); | ||
Assert.assertTrue(rule.isValid(resource)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.