Skip to content

Commit

Permalink
fix(test): adjust defer invocations (prometheus#14996)
Browse files Browse the repository at this point in the history
Signed-off-by: machine424 <[email protected]>
  • Loading branch information
machine424 authored Sep 27, 2024
1 parent 7aa4721 commit 105ab2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion storage/remote/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ func TestSampleAndChunkQueryableClient(t *testing.T) {
)
q, err := c.Querier(tc.mint, tc.maxt)
require.NoError(t, err)
defer require.NoError(t, q.Close())
defer func() {
require.NoError(t, q.Close())
}()

ss := q.Select(context.Background(), true, nil, tc.matchers...)
require.NoError(t, err)
Expand Down
4 changes: 3 additions & 1 deletion tsdb/agent/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,9 @@ func Test_ExistingWAL_NextRef(t *testing.T) {
// Create a new storage and see what nextRef is initialized to.
db, err = Open(log.NewNopLogger(), nil, rs, dbDir, DefaultOptions())
require.NoError(t, err)
defer require.NoError(t, db.Close())
defer func() {
require.NoError(t, db.Close())
}()

require.Equal(t, uint64(seriesCount+histogramCount), db.nextRef.Load(), "nextRef should be equal to the number of series written across the entire WAL")
}
Expand Down

0 comments on commit 105ab2e

Please sign in to comment.