fix missing db.Close() in web_test.go in order to avoid goroutine leak (#10035)

Signed-off-by: Shihao Xia <charlesxsh@hotmail.com>
This commit is contained in:
Shihao Xia 2021-12-20 07:07:53 -05:00 committed by GitHub
parent 27343277fa
commit f5c3ea1bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))