From 849faa407b9bc8d1faacc56636f57a7d0fa856ed Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Mon, 10 Feb 2020 12:46:10 +0000 Subject: [PATCH] Minor fixes. Signed-off-by: Bartlomiej Plotka --- promql/test.go | 5 ++--- tsdb/chunkenc/chunk.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) 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 }