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

Function createAndPutKeys

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

Source from the content-addressed store, hash-verified

31}
32
33func createAndPutKeys(t *testing.T) {
34 t.Parallel()
35
36 db, cleanup := createDb(t)
37 defer cleanup()
38
39 bucketName := []byte("bucket")
40
41 for i := 0; i < 100; i++ {
42 err := db.Update(func(tx *Tx) error {
43 nodes, err := tx.CreateBucketIfNotExists(bucketName)
44 if err != nil {
45 return err
46 }
47
48 var key [16]byte
49 _, rerr := rand.Read(key[:])
50 if rerr != nil {
51 return rerr
52 }
53 if err := nodes.Put(key[:], nil); err != nil {
54 return err
55 }
56
57 return nil
58 })
59 if err != nil {
60 t.Fatal(err)
61 }
62 }
63}
64
65func TestManyDBs(t *testing.T) {
66 if testing.Short() {

Callers

nothing calls this directly

Calls 6

createDbFunction · 0.85
UpdateMethod · 0.80
ReadMethod · 0.65
FatalMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected