mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 23:42:32 +00:00
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:
parent
27343277fa
commit
f5c3ea1bf2
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user