fix missing db.Close() in web_test.go in order to avoid goroutine leak
@@ -116,7 +116,9 @@ func TestReadyAndHealthy(t *testing.T) {
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
require.NoError(t, err)
-
+ t.Cleanup(func() {
+ require.NoError(t, db.Close())
+ })
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
opts := &Options{
@@ -237,6 +239,9 @@ func TestRoutePrefix(t *testing.T) {
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
require.NoError(t, err)
+ t.Cleanup(func() {
+ require.NoError(t, db.Close())
+ })
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
@@ -404,7 +409,9 @@ func TestShutdownWithStaleConnection(t *testing.T) {
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
require.NoError(t, err)
-
+ t.Cleanup(func() {
+ require.NoError(t, db.Close())
+ })
timeout := 10 * time.Second
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
