MCPcopy
hub / github.com/etcd-io/bbolt / mustOpenDB

Function mustOpenDB

concurrent_test.go:234–251  ·  view source on GitHub ↗
(t *testing.T, dbPath string, o *bolt.Options)

Source from the content-addressed store, hash-verified

232}
233
234func mustOpenDB(t *testing.T, dbPath string, o *bolt.Options) *bolt.DB {
235 t.Logf("Opening bbolt DB at: %s", dbPath)
236 if o == nil {
237 o = bolt.DefaultOptions
238 }
239
240 freelistType := bolt.FreelistArrayType
241 if env := os.Getenv("TEST_FREELIST_TYPE"); env == string(bolt.FreelistMapType) {
242 freelistType = bolt.FreelistMapType
243 }
244
245 o.FreelistType = freelistType
246
247 db, err := bolt.Open(dbPath, 0600, o)
248 require.NoError(t, err)
249
250 return db
251}
252
253func checkConsistency(t *testing.T, db *bolt.DB) error {
254 return db.View(func(tx *bolt.Tx) error {

Callers 2

mustCreateDBFunction · 0.85
mustReOpenDBFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected