diff --git a/promql/test.go b/promql/test.go index 07508f13a..b0e0f9af7 100644 --- a/promql/test.go +++ b/promql/test.go @@ -411,10 +411,9 @@ func (cmd clearCmd) String() string { // is reached, evaluation errors do not terminate execution. func (t *Test) Run() error { for _, cmd := range t.cmds { - err := t.exec(cmd) // TODO(fabxc): aggregate command errors, yield diffs for result // comparison errors. - if err != nil { + if err := t.exec(cmd); err != nil { return err } } @@ -443,6 +442,7 @@ func (t *Test) exec(tc testCommand) error { if err != nil { return err } + defer q.Close() res := q.Exec(t.context) if res.Err != nil { if cmd.fail { @@ -450,7 +450,6 @@ func (t *Test) exec(tc testCommand) error { } return errors.Wrapf(res.Err, "error evaluating query %q (line %d)", cmd.expr, cmd.line) } - defer q.Close() if res.Err == nil && cmd.fail { return errors.Errorf("expected error evaluating query %q (line %d) but got none", cmd.expr, cmd.line) } diff --git a/tsdb/chunkenc/chunk.go b/tsdb/chunkenc/chunk.go index 1e21003d3..d5a09b9de 100644 --- a/tsdb/chunkenc/chunk.go +++ b/tsdb/chunkenc/chunk.go @@ -88,7 +88,7 @@ type Iterator interface { // TODO(bwplotka): Verify above statement on all implementations with unit test. At() (int64, float64) // Err returns the current error. - // Err can return undefined value before the iterator has advanced. + // Err can return undefined value before calling `Next` or `Seek`. Err() error }