Skip to content

Commit

Permalink
Improve the parser hint tests. (#3429)
Browse files Browse the repository at this point in the history
I was able to find out where was the issue with that test yesterday.
Now I realized that we can mutate (re-slice) the given log line, and so other test would fail.

This also make the parallel back.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
cyriltovena authored Mar 4, 2021
1 parent 7e9ac16 commit ce4f785
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/logql/log/parser_hints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ var (
)

func Test_ParserHints(t *testing.T) {
lbs := labels.Labels{{Name: "app", Value: "nginx"}, {Name: "cluster", Value: "us-central-west"}}

t.Parallel()
for _, tt := range []struct {
expr string
Expand Down Expand Up @@ -206,13 +208,13 @@ func Test_ParserHints(t *testing.T) {
} {
tt := tt
t.Run(tt.expr, func(t *testing.T) {
lbs := labels.Labels{{Name: "app", Value: "nginx"}, {Name: "cluster", Value: "us-central-west"}}
t.Parallel()
expr, err := logql.ParseSampleExpr(tt.expr)
require.NoError(t, err)

ex, err := expr.Extractor()
require.NoError(t, err)
v, lbsRes, ok := ex.ForStream(lbs).Process(tt.line)
v, lbsRes, ok := ex.ForStream(lbs).Process(append([]byte{}, tt.line...))
var lbsResString string
if lbsRes != nil {
lbsResString = lbsRes.String()
Expand Down

0 comments on commit ce4f785

Please sign in to comment.