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

Function TestBoltDbStore_StoreLogs

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

Source from the content-addressed store, hash-verified

139
140}
141func TestBoltDbStore_StoreLogs(t *testing.T) {
142 r, err := testBoltDatastore()
143 assert.NoError(t, err)
144
145 logs := []*raft.Log{
146 createRaftLog(1, "test1"),
147 createRaftLog(23, "test3"),
148 createRaftLog(8, "test2"),
149 }
150 err = r.StoreLogs(logs)
151 assert.NoError(t, err)
152 // get the logs
153 var log1, log2, log3, log5 raft.Log
154 _ = r.GetLog(1, &log1)
155 _ = r.GetLog(23, &log2)
156 _ = r.GetLog(8, &log3)
157
158 assert.Equal(t, log1, *logs[0])
159 assert.Equal(t, log2, *logs[1])
160 assert.Equal(t, log3, *logs[2])
161
162 // check for errors
163 err = r.GetLog(4, &log5)
164 assert.True(t, err != nil)
165
166}
167
168func TestBoltDbStore_Set(t *testing.T) {
169 ds, err := testBoltDatastore()

Callers

nothing calls this directly

Calls 4

testBoltDatastoreFunction · 0.85
createRaftLogFunction · 0.85
StoreLogsMethod · 0.45
GetLogMethod · 0.45

Tested by

no test coverage detected