Skip to content

Commit

Permalink
name and kind filters are not case-sensitive (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryane authored Jul 4, 2019
1 parent 109c8bb commit 3d2093f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/filter/kind_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (f *kindMatcher) Match(u unstructured.Unstructured) bool {
}

for _, kind := range f.kinds {
if kind == u.GetKind() {
if strings.EqualFold(kind, u.GetKind()) {
return true
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/filter/kind_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestKindFilter(t *testing.T) {
}{
{[]string{"ServiceAccount"}, []string{"test-sa", "test-sa-2"}},
{[]string{"Deployment"}, []string{"test-deployment"}},
{[]string{"deployment"}, []string{"test-deployment"}},
{[]string{"Pod"}, []string{"test-pod"}},
{[]string{"ServiceAccount", "Deployment"}, []string{"test-sa", "test-sa-2", "test-deployment"}},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/filter/name_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (f *nameMatcher) Match(u unstructured.Unstructured) bool {
}

for _, name := range f.names {
if name == u.GetName() {
if strings.EqualFold(name, u.GetName()) {
return true
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/filter/name_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestNameFilter(t *testing.T) {
{[]string{"test-sa"}, []string{"test-sa"}},
{[]string{"test-sa", "test-sa-2"}, []string{"test-sa", "test-sa-2"}},
{[]string{"test-deployment"}, []string{"test-deployment"}},
{[]string{"TEST-DEPLOYMENT"}, []string{"test-deployment"}},
{[]string{"test-deployment", "test-pod"}, []string{"test-pod", "test-deployment"}},
}

Expand Down

0 comments on commit 3d2093f

Please sign in to comment.