Skip to content

Commit

Permalink
Extended test query to expose broken query. Parsed logql correctly in…
Browse files Browse the repository at this point in the history
… validate (#1044)

Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott authored and cyriltovena committed Sep 23, 2019
1 parent 9614b02 commit 7794d15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,11 @@ func (q *Querier) validateQueryRequest(ctx context.Context, req *logproto.QueryR
return err
}

matchers, err := logql.ParseMatchers(req.Selector)
selector, err := logql.ParseLogSelector(req.Selector)
if err != nil {
return err
}
matchers := selector.Matchers()

maxStreamMatchersPerQuery := q.limits.MaxStreamsMatchersPerQuery(userID)
if len(matchers) > maxStreamMatchersPerQuery {
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func defaultLimitsTestConfig() validation.Limits {

func TestQuerier_validateQueryRequest(t *testing.T) {
request := logproto.QueryRequest{
Selector: "{type=\"test\", fail=\"yes\"}",
Selector: "{type=\"test\", fail=\"yes\"} |= \"foo\"",
Limit: 10,
Start: time.Now().Add(-1 * time.Minute),
End: time.Now(),
Expand Down

0 comments on commit 7794d15

Please sign in to comment.