tsdb tests: avoid 'defer' till end of function

'defer' only runs at the end of the function, so explicitly close the
querier after we finish with it. Also check it didn't error.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2023-11-27 15:17:08 +00:00
parent 2f615a200d
commit 6ba25ba93f

View File

@ -1594,7 +1594,6 @@ func TestDelete_e2e(t *testing.T) {
for i := 0; i < numRanges; i++ {
q, err := NewBlockQuerier(hb, 0, 100000)
require.NoError(t, err)
defer q.Close()
ss := q.Select(context.Background(), true, nil, del.ms...)
// Build the mockSeriesSet.
matchedSeries := make([]storage.Series, 0, len(matched))
@ -1635,6 +1634,7 @@ func TestDelete_e2e(t *testing.T) {
}
require.NoError(t, ss.Err())
require.Empty(t, ss.Warnings())
require.NoError(t, q.Close())
}
}
}