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

Function TestNode_split_MinKeys

node_test.go:137–150  ·  view source on GitHub ↗

Ensure that a page with the minimum number of inodes just returns a single node.

(t *testing.T)

Source from the content-addressed store, hash-verified

135
136// Ensure that a page with the minimum number of inodes just returns a single node.
137func TestNode_split_MinKeys(t *testing.T) {
138 // Create a node.
139 m := &common.Meta{}
140 m.SetPgid(1)
141 n := &node{inodes: make(common.Inodes, 0), bucket: &Bucket{tx: &Tx{db: &DB{}, meta: m}}}
142 n.put([]byte("00000001"), []byte("00000001"), []byte("0123456701234567"), 0, 0)
143 n.put([]byte("00000002"), []byte("00000002"), []byte("0123456701234567"), 0, 0)
144
145 // Split.
146 n.split(20)
147 if n.parent != nil {
148 t.Fatalf("expected nil parent")
149 }
150}
151
152// Ensure that a node that has keys that all fit on a page just returns one leaf.
153func TestNode_split_SinglePage(t *testing.T) {

Callers

nothing calls this directly

Calls 4

SetPgidMethod · 0.95
putMethod · 0.95
splitMethod · 0.95
FatalfMethod · 0.65

Tested by

no test coverage detected