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

Function TestInMemStore_GetLog

lib/datastore/inmem_test.go:21–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestInMemStore_GetLog(t *testing.T) {
22 ds := testMemoryDatastore()
23 logs := []*raft.Log{
24 createRaftLog(1, "test1"),
25 createRaftLog(2, "test2"),
26 createRaftLog(23, "test3"),
27 }
28 err := ds.StoreLogs(logs)
29 assert.NoError(t, err)
30 // get the logs
31 var log raft.Log
32 err = ds.GetLog(1, &log)
33 assert.NoError(t, err)
34 assert.Equal(t, log, *logs[0])
35 // get log of id 23
36 err = ds.GetLog(23, &log)
37 assert.NoError(t, err)
38 assert.Equal(t, log, *logs[2])
39}
40
41func TestInMemStore_DeleteRange(t *testing.T) {
42 ds := testMemoryDatastore()

Callers

nothing calls this directly

Calls 4

testMemoryDatastoreFunction · 0.85
createRaftLogFunction · 0.85
StoreLogsMethod · 0.45
GetLogMethod · 0.45

Tested by

no test coverage detected