(t *testing.T)
| 77 | } |
| 78 | |
| 79 | func TestWALEncoderDecoder(t *testing.T) { |
| 80 | now := tmtime.Now() |
| 81 | msgs := []TimedWALMessage{ |
| 82 | {Time: now, Msg: EndHeightMessage{0}}, |
| 83 | {Time: now, Msg: timeoutInfo{Duration: time.Second, Height: 1, Round: 1, Step: types.RoundStepPropose}}, |
| 84 | {Time: now, Msg: tmtypes.EventDataRoundState{Height: 1, Round: 1, Step: ""}}, |
| 85 | } |
| 86 | |
| 87 | b := new(bytes.Buffer) |
| 88 | |
| 89 | for _, msg := range msgs { |
| 90 | msg := msg |
| 91 | |
| 92 | b.Reset() |
| 93 | |
| 94 | enc := NewWALEncoder(b) |
| 95 | err := enc.Encode(&msg) |
| 96 | require.NoError(t, err) |
| 97 | |
| 98 | dec := NewWALDecoder(b) |
| 99 | decoded, err := dec.Decode() |
| 100 | require.NoError(t, err) |
| 101 | assert.Equal(t, msg.Time.UTC(), decoded.Time) |
| 102 | assert.Equal(t, msg.Msg, decoded.Msg) |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | func TestWALWrite(t *testing.T) { |
| 107 | walDir := t.TempDir() |
nothing calls this directly
no test coverage detected
searching dependent graphs…