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

Function createDb

manydbs_test.go:11–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func createDb(t *testing.T) (*DB, func()) {
12 // First, create a temporary directory to be used for the duration of
13 // this test.
14 tempDirName, err := os.MkdirTemp("", "bboltmemtest")
15 if err != nil {
16 t.Fatalf("error creating temp dir: %v", err)
17 }
18 path := filepath.Join(tempDirName, "testdb.db")
19
20 bdb, err := Open(path, 0600, nil)
21 if err != nil {
22 t.Fatalf("error creating bbolt db: %v", err)
23 }
24
25 cleanup := func() {
26 bdb.Close()
27 os.RemoveAll(tempDirName)
28 }
29
30 return bdb, cleanup
31}
32
33func createAndPutKeys(t *testing.T) {
34 t.Parallel()

Callers 1

createAndPutKeysFunction · 0.85

Calls 3

OpenFunction · 0.85
FatalfMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected