MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestBoltDbStore_LastIndex

Function TestBoltDbStore_LastIndex

lib/datastore/boltdb_test.go:75–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73
74}
75func TestBoltDbStore_LastIndex(t *testing.T) {
76 r, err := testBoltDatastore()
77 assert.NoError(t, err)
78 logs := []*raft.Log{
79 createRaftLog(1, "test1"),
80 createRaftLog(2, "test2"),
81 createRaftLog(23, "test3"),
82 createRaftLog(6, "test4"),
83 }
84 err = r.StoreLogs(logs)
85 assert.NoError(t, err)
86
87 //
88 li, err := r.LastIndex()
89 assert.NoError(t, err)
90 assert.EqualValues(t, 23, li)
91 // remove first element
92 _ = r.DeleteRange(9, 50)
93 li, err = r.LastIndex()
94 assert.NoError(t, err)
95 assert.EqualValues(t, 6, li)
96
97}
98func TestBoltDbStore_GetLog(t *testing.T) {
99 r, err := testBoltDatastore()
100 assert.NoError(t, err)

Callers

nothing calls this directly

Calls 5

testBoltDatastoreFunction · 0.85
createRaftLogFunction · 0.85
StoreLogsMethod · 0.45
LastIndexMethod · 0.45
DeleteRangeMethod · 0.45

Tested by

no test coverage detected