mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
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:
parent
5da8990053
commit
1dbd799354
|
@ -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.
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue