-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable aws task definition scraper by default
- Loading branch information
1 parent
e13b4a9
commit 0b8e857
Showing
2 changed files
with
79 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package v1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAWS_Includes(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
config AWS | ||
resource string | ||
want bool | ||
}{ | ||
{ | ||
name: "empty include list, not in default exclusions", | ||
config: AWS{}, | ||
resource: "ec2", | ||
want: true, | ||
}, | ||
{ | ||
name: "empty include list, in default exclusions", | ||
config: AWS{}, | ||
resource: "ECSTASKDEFINITION", | ||
want: false, | ||
}, | ||
{ | ||
name: "explicit inclusion of default exclusion", | ||
config: AWS{Include: []string{"EcsTaskDefinition"}}, | ||
resource: "ECSTASKDEFINITION", | ||
want: true, | ||
}, | ||
{ | ||
name: "non-empty include list, resource included", | ||
config: AWS{ | ||
Include: []string{"s3", "ec2", "rds"}, | ||
}, | ||
resource: "ec2", | ||
want: true, | ||
}, | ||
{ | ||
name: "non-empty include list, resource not included", | ||
config: AWS{ | ||
Include: []string{"s3", "ec2", "rds"}, | ||
}, | ||
resource: "lambda", | ||
want: false, | ||
}, | ||
{ | ||
name: "case-insensitive include", | ||
config: AWS{ | ||
Include: []string{"S3", "EC2", "RDS"}, | ||
}, | ||
resource: "ec2", | ||
want: true, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := tt.config.Includes(tt.resource) | ||
assert.Equal(t, tt.want, got) | ||
}) | ||
} | ||
} |