|
|
|
@ -1003,13 +1003,6 @@ func (t *test) execRangeEval(cmd *evalCmd, engine promql.QueryEngine) error {
|
|
|
|
|
return fmt.Errorf("error creating range query for %q (line %d): %w", cmd.expr, cmd.line, err)
|
|
|
|
|
}
|
|
|
|
|
res := q.Exec(t.context)
|
|
|
|
|
countWarnings, _ := res.Warnings.CountWarningsAndInfo()
|
|
|
|
|
if !cmd.warn && countWarnings > 0 {
|
|
|
|
|
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", cmd.expr, cmd.line, res.Warnings)
|
|
|
|
|
}
|
|
|
|
|
if cmd.warn && countWarnings == 0 {
|
|
|
|
|
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
if res.Err != nil {
|
|
|
|
|
if cmd.fail {
|
|
|
|
|
return cmd.checkExpectedFailure(res.Err)
|
|
|
|
@ -1020,6 +1013,13 @@ func (t *test) execRangeEval(cmd *evalCmd, engine promql.QueryEngine) error {
|
|
|
|
|
if res.Err == nil && cmd.fail {
|
|
|
|
|
return fmt.Errorf("expected error evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
countWarnings, _ := res.Warnings.CountWarningsAndInfo()
|
|
|
|
|
if !cmd.warn && countWarnings > 0 {
|
|
|
|
|
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", cmd.expr, cmd.line, res.Warnings)
|
|
|
|
|
}
|
|
|
|
|
if cmd.warn && countWarnings == 0 {
|
|
|
|
|
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
defer q.Close()
|
|
|
|
|
|
|
|
|
|
if err := cmd.compareResult(res.Value); err != nil {
|
|
|
|
@ -1050,13 +1050,6 @@ func (t *test) runInstantQuery(iq atModifierTestCase, cmd *evalCmd, engine promq
|
|
|
|
|
}
|
|
|
|
|
defer q.Close()
|
|
|
|
|
res := q.Exec(t.context)
|
|
|
|
|
countWarnings, _ := res.Warnings.CountWarningsAndInfo()
|
|
|
|
|
if !cmd.warn && countWarnings > 0 {
|
|
|
|
|
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", iq.expr, cmd.line, res.Warnings)
|
|
|
|
|
}
|
|
|
|
|
if cmd.warn && countWarnings == 0 {
|
|
|
|
|
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", iq.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
if res.Err != nil {
|
|
|
|
|
if cmd.fail {
|
|
|
|
|
if err := cmd.checkExpectedFailure(res.Err); err != nil {
|
|
|
|
@ -1070,6 +1063,13 @@ func (t *test) runInstantQuery(iq atModifierTestCase, cmd *evalCmd, engine promq
|
|
|
|
|
if res.Err == nil && cmd.fail {
|
|
|
|
|
return fmt.Errorf("expected error evaluating query %q (line %d) but got none", iq.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
countWarnings, _ := res.Warnings.CountWarningsAndInfo()
|
|
|
|
|
if !cmd.warn && countWarnings > 0 {
|
|
|
|
|
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", iq.expr, cmd.line, res.Warnings)
|
|
|
|
|
}
|
|
|
|
|
if cmd.warn && countWarnings == 0 {
|
|
|
|
|
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", iq.expr, cmd.line)
|
|
|
|
|
}
|
|
|
|
|
err = cmd.compareResult(res.Value)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("error in %s %s (line %d): %w", cmd, iq.expr, cmd.line, err)
|
|
|
|
|