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