PromQL: Fix regression tests (#6935)

This PR fixes the regression tests for the issue fixed in #6931 .

The reason for that is that all of the invalid queries that triggered the regression have become more or less valid syntax in #6933 (they might still fail typechecking).

Signed-off-by: Tobias Guggenmos <tobias.guggenmos@uni-ulm.de>
This commit is contained in:
Tobias Guggenmos 2020-03-06 09:17:01 +01:00 committed by GitHub
parent 5da8990053
commit 1dbd799354
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2167,15 +2167,52 @@ var testExpr = []struct {
}, {
input: "rate(avg)",
fail: true,
errMsg: `unexpected ")"`,
errMsg: `expected type range vector`,
}, {
input: "sum(sum)",
fail: true,
errMsg: `unexpected ")"`,
input: "sum(sum)",
expected: &AggregateExpr{
Op: SUM,
Expr: &VectorSelector{
Name: "sum",
LabelMatchers: []*labels.Matcher{
mustLabelMatcher(labels.MatchEqual, string(model.MetricNameLabel), "sum"),
},
PosRange: PositionRange{
Start: 4,
End: 7,
},
},
PosRange: PositionRange{
Start: 0,
End: 8,
},
},
}, {
input: "a + sum",
fail: true,
errMsg: `unexpected end of input`,
input: "a + sum",
expected: &BinaryExpr{
Op: ADD,
LHS: &VectorSelector{
Name: "a",
LabelMatchers: []*labels.Matcher{
mustLabelMatcher(labels.MatchEqual, string(model.MetricNameLabel), "a"),
},
PosRange: PositionRange{
Start: 0,
End: 1,
},
},
RHS: &VectorSelector{
Name: "sum",
LabelMatchers: []*labels.Matcher{
mustLabelMatcher(labels.MatchEqual, string(model.MetricNameLabel), "sum"),
},
PosRange: PositionRange{
Start: 4,
End: 7,
},
},
VectorMatching: &VectorMatching{},
},
},
// String quoting and escape sequence interpretation tests.
{