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

Function TestInMemStore_StoreLogs

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

Source from the content-addressed store, hash-verified

85}
86
87func TestInMemStore_StoreLogs(t *testing.T) {
88 ds := testMemoryDatastore()
89 logs := []*raft.Log{
90 createRaftLog(1, "test1"),
91 createRaftLog(2, "test2"),
92 createRaftLog(23, "test3"),
93 createRaftLog(6, "test4"),
94 }
95 err := ds.StoreLogs(logs)
96 assert.NoError(t, err)
97 // get the logs
98 var log1, log2, log3, log4, log5 raft.Log
99 _ = ds.GetLog(1, &log1)
100 _ = ds.GetLog(2, &log2)
101 _ = ds.GetLog(23, &log3)
102 _ = ds.GetLog(6, &log4)
103
104 assert.Equal(t, log1, *logs[0])
105 assert.Equal(t, log2, *logs[1])
106 assert.Equal(t, log3, *logs[2])
107 assert.Equal(t, log4, *logs[3])
108
109 // check for errors
110 err = ds.GetLog(4, &log5)
111 assert.True(t, err != nil)
112
113}
114
115func TestInMemStore_FirstIndex(t *testing.T) {
116 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