tsdb/wlog: add test for metrics unregistering

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
This commit is contained in:
Giedrius Statkevičius 2024-04-18 11:11:37 +03:00
parent 3b8fe00767
commit bdf490726a

View File

@ -23,6 +23,8 @@ import (
"path/filepath"
"testing"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
client_testutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
@ -561,3 +563,13 @@ func BenchmarkWAL_Log(b *testing.B) {
})
}
}
func TestUnregisterMetrics(t *testing.T) {
reg := prometheus.NewRegistry()
for i := 0; i < 2; i++ {
wl, err := New(log.NewNopLogger(), reg, t.TempDir(), CompressionNone)
require.NoError(t, err)
require.NoError(t, wl.Close())
}
}