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

Function TestFlyDbStore_LastIndex

lib/datastore/flydb_test.go:76–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

testFlyDbDatastoreFunction · 0.85
createRaftLogFunction · 0.85
StoreLogsMethod · 0.45
LastIndexMethod · 0.45
DeleteRangeMethod · 0.45

Tested by

no test coverage detected