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

Function TestTx_MoveBucket

movebucket_test.go:17–217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestTx_MoveBucket(t *testing.T) {
18 testCases := []struct {
19 name string
20 srcBucketPath []string
21 dstBucketPath []string
22 bucketToMove string
23 bucketExistInSrc bool
24 bucketExistInDst bool
25 hasIncompatibleKeyInSrc bool
26 hasIncompatibleKeyInDst bool
27 expectedErr error
28 }{
29 // normal cases
30 {
31 name: "normal case",
32 srcBucketPath: []string{"sb1", "sb2"},
33 dstBucketPath: []string{"db1", "db2"},
34 bucketToMove: "bucketToMove",
35 bucketExistInSrc: true,
36 bucketExistInDst: false,
37 hasIncompatibleKeyInSrc: false,
38 hasIncompatibleKeyInDst: false,
39 expectedErr: nil,
40 },
41 {
42 name: "the source and target bucket share the same grandparent",
43 srcBucketPath: []string{"grandparent", "sb2"},
44 dstBucketPath: []string{"grandparent", "db2"},
45 bucketToMove: "bucketToMove",
46 bucketExistInSrc: true,
47 bucketExistInDst: false,
48 hasIncompatibleKeyInSrc: false,
49 hasIncompatibleKeyInDst: false,
50 expectedErr: nil,
51 },
52 {
53 name: "bucketToMove is a top level bucket",
54 srcBucketPath: []string{},
55 dstBucketPath: []string{"db1", "db2"},
56 bucketToMove: "bucketToMove",
57 bucketExistInSrc: true,
58 bucketExistInDst: false,
59 hasIncompatibleKeyInSrc: false,
60 hasIncompatibleKeyInDst: false,
61 expectedErr: nil,
62 },
63 {
64 name: "convert bucketToMove to a top level bucket",
65 srcBucketPath: []string{"sb1", "sb2"},
66 dstBucketPath: []string{},
67 bucketToMove: "bucketToMove",
68 bucketExistInSrc: true,
69 bucketExistInDst: false,
70 hasIncompatibleKeyInSrc: false,
71 hasIncompatibleKeyInDst: false,
72 expectedErr: nil,
73 },
74 // negative cases

Callers

nothing calls this directly

Calls 9

MustCreateDBWithOptionFunction · 0.92
prepareBucketsFunction · 0.85
openBucketFunction · 0.85
dumpBucketFunction · 0.85
RunMethod · 0.80
UpdateMethod · 0.80
PutMethod · 0.45
MoveBucketMethod · 0.45

Tested by

no test coverage detected