Skip to content

Commit

Permalink
fix bug that caused logs to not be rendered when --filter-status was …
Browse files Browse the repository at this point in the history
…empty
  • Loading branch information
atomicptr committed Apr 4, 2020
1 parent 3159bdd commit 40f70fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func NewFilter() *Filter {

// IsValid checks if the query is valid for the given value
func (f *Filter) IsValid(query string, value int64) bool {
// empty means no filter was supplied which is always good!
if query == "" {
return true
}

queries := strings.Split(query, ",")

result := false
Expand Down
7 changes: 7 additions & 0 deletions pkg/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import (
"testing"
)

func TestFilterIsValidEmptyQuery(t *testing.T) {
filter := NewFilter()
assert.True(t, filter.IsValid("", 200))
assert.True(t, filter.IsValid("", 404))
assert.True(t, filter.IsValid("", 500))
}

func TestFilterIsValidSimple(t *testing.T) {
filter := NewFilter()
assert.True(t, filter.IsValid("200", 200))
Expand Down

0 comments on commit 40f70fb

Please sign in to comment.