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

Function TestMlock_DbCanGrow_Small

unix_test.go:23–46  ·  view source on GitHub ↗

Test change between "empty" (16KB) and "non-empty" db

(t *testing.T)

Source from the content-addressed store, hash-verified

21
22// Test change between "empty" (16KB) and "non-empty" db
23func TestMlock_DbCanGrow_Small(t *testing.T) {
24 // 32KB
25 skipOnMemlockLimitBelow(t, 32*1024)
26
27 db := btesting.MustCreateDBWithOption(t, &bolt.Options{Mlock: true})
28
29 if err := db.Update(func(tx *bolt.Tx) error {
30 b, err := tx.CreateBucketIfNotExists([]byte("bucket"))
31 if err != nil {
32 t.Fatal(err)
33 }
34
35 key := []byte("key")
36 value := []byte("value")
37 if err := b.Put(key, value); err != nil {
38 t.Fatal(err)
39 }
40
41 return nil
42 }); err != nil {
43 t.Fatal(err)
44 }
45
46}
47
48// Test crossing of 16MB (AllocSize) of db size
49func TestMlock_DbCanGrow_Big(t *testing.T) {

Callers

nothing calls this directly

Calls 6

MustCreateDBWithOptionFunction · 0.92
skipOnMemlockLimitBelowFunction · 0.85
UpdateMethod · 0.80
FatalMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected