Skip to content

Commit

Permalink
Merge pull request #217 from mumoshu/less-verbose-unmatched-selector-…
Browse files Browse the repository at this point in the history
…logging

fix: Make logging on unmatched selectors less verbose
  • Loading branch information
mumoshu authored Aug 23, 2018
2 parents d609dab + fcb75fa commit c402759
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ func (state *HelmState) FilterReleases(labels []string) error {
filteredReleases = append(filteredReleases, r)
}
if len(filteredReleases) == 0 {
return fmt.Errorf("specified selector did not match any releases in %s\n", state.file)
state.logger.Debugf("specified selector did not match any releases in %s\n", state.file)
return nil
}
state.Releases = filteredReleases
return nil
Expand Down
5 changes: 3 additions & 2 deletions state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,18 +861,19 @@ func TestHelmState_NoReleaseMatched(t *testing.T) {
{
name: "name does not exist",
labels: "name=releaseB",
wantErr: true,
wantErr: false,
},
{
name: "label does not match anything",
labels: "foo=notbar",
wantErr: true,
wantErr: false,
},
}
for _, tt := range tests {
i := func(t *testing.T) {
state := &HelmState{
Releases: releases,
logger: logger,
}
errs := state.FilterReleases([]string{tt.labels})
if (errs != nil) != tt.wantErr {
Expand Down

0 comments on commit c402759

Please sign in to comment.