github.com/grafana/pyroscope@v1.18.0/pkg/test/boltdb.go (about) 1 package test 2 3 import ( 4 "path/filepath" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 "go.etcd.io/bbolt" 9 ) 10 11 func BoltDB(t testing.TB) *bbolt.DB { 12 tempDir := t.TempDir() 13 opts := bbolt.Options{ 14 NoGrowSync: true, 15 NoFreelistSync: true, 16 FreelistType: bbolt.FreelistMapType, 17 InitialMmapSize: 32 << 20, 18 NoSync: true, 19 } 20 db, err := bbolt.Open(filepath.Join(tempDir, "boltdb"), 0644, &opts) 21 require.NoError(t, err) 22 return db 23 }