mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08: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)
|
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
t.Cleanup(func() {
|
||||||
|
require.NoError(t, db.Close())
|
||||||
|
})
|
||||||
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
|
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
|
||||||
|
|
||||||
opts := &Options{
|
opts := &Options{
|
||||||
|
@ -237,6 +239,9 @@ func TestRoutePrefix(t *testing.T) {
|
||||||
|
|
||||||
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
|
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
t.Cleanup(func() {
|
||||||
|
require.NoError(t, db.Close())
|
||||||
|
})
|
||||||
|
|
||||||
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
|
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)
|
db, err := tsdb.Open(dbDir, nil, nil, nil, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
t.Cleanup(func() {
|
||||||
|
require.NoError(t, db.Close())
|
||||||
|
})
|
||||||
timeout := 10 * time.Second
|
timeout := 10 * time.Second
|
||||||
|
|
||||||
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
|
port := fmt.Sprintf(":%d", testutil.RandomUnprivilegedPort(t))
|
||||||
|
|
Loading…
Reference in a new issue