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

Function TestFlyDbStore_StoreLogs

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

testFlyDbDatastoreFunction · 0.85
createRaftLogFunction · 0.85
StoreLogsMethod · 0.45
GetLogMethod · 0.45

Tested by

no test coverage detected