mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-30 15:12:27 -08:00
Merge pull request #952 from prometheus/promql-test
promql: Test errors aren't always ParseErr
This commit is contained in:
commit
2983a9ad76
|
@ -114,8 +114,9 @@ func (t *Test) parseLoad(lines []string, i int) (int, *loadCmd, error) {
|
||||||
}
|
}
|
||||||
metric, vals, err := parseSeriesDesc(defLine)
|
metric, vals, err := parseSeriesDesc(defLine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
perr := err.(*ParseErr)
|
if perr, ok := err.(*ParseErr); ok {
|
||||||
perr.Line = i + 1
|
perr.Line = i + 1
|
||||||
|
}
|
||||||
return i, nil, err
|
return i, nil, err
|
||||||
}
|
}
|
||||||
cmd.set(metric, vals...)
|
cmd.set(metric, vals...)
|
||||||
|
@ -135,10 +136,11 @@ func (t *Test) parseEval(lines []string, i int) (int, *evalCmd, error) {
|
||||||
)
|
)
|
||||||
expr, err := ParseExpr(qry)
|
expr, err := ParseExpr(qry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
perr := err.(*ParseErr)
|
if perr, ok := err.(*ParseErr); ok {
|
||||||
perr.Line = i + 1
|
perr.Line = i + 1
|
||||||
perr.Pos += strings.Index(lines[i], qry)
|
perr.Pos += strings.Index(lines[i], qry)
|
||||||
return i, nil, perr
|
}
|
||||||
|
return i, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
offset, err := strutil.StringToDuration(at)
|
offset, err := strutil.StringToDuration(at)
|
||||||
|
@ -168,8 +170,9 @@ func (t *Test) parseEval(lines []string, i int) (int, *evalCmd, error) {
|
||||||
}
|
}
|
||||||
metric, vals, err := parseSeriesDesc(defLine)
|
metric, vals, err := parseSeriesDesc(defLine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
perr := err.(*ParseErr)
|
if perr, ok := err.(*ParseErr); ok {
|
||||||
perr.Line = i + 1
|
perr.Line = i + 1
|
||||||
|
}
|
||||||
return i, nil, err
|
return i, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue