(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func 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 | |
| 115 | func TestInMemStore_FirstIndex(t *testing.T) { |
| 116 | ds := testMemoryDatastore() |
nothing calls this directly
no test coverage detected