Skip to content

Commit 98e8ba8

Browse files
committed
raft: fix conditions for wal repair tests
In etcd v3.6 implementation has changed and now returns successful raipair for the test conditions. Signed-off-by: Tonis Tiigi <[email protected]>
1 parent f658780 commit 98e8ba8

File tree

3 files changed

+4
-40
lines changed

3 files changed

+4
-40
lines changed

manager/state/raft/storage/walwrap_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,16 @@ func TestReadRepairWAL(t *testing.T) {
261261
require.Equal(t, metadata, waldata.Metadata)
262262
require.NoError(t, ogWAL.Close())
263263

264-
// Also run with a file beyond repair.
264+
// Also run with a file beyond repair (<3.6.0)
265265
tempdir = createWithWAL(t, OriginalWAL, metadata, snapshot, entries)
266266
files, err = os.ReadDir(tempdir)
267267
require.NoError(t, err)
268268
require.Len(t, files, 1)
269269
require.NoError(t, os.Truncate(filepath.Join(tempdir, files[0].Name()), 200))
270270

271271
_, _, err = ReadRepairWAL(context.Background(), tempdir, snapshot, OriginalWAL)
272-
require.ErrorContains(t, err, "[wal] max entry size limit exceeded")
272+
// in etcd 3.6+ this is reported repairable as well
273+
require.NoError(t, err)
273274
}
274275

275276
func TestMigrateWALs(t *testing.T) {

manager/state/raft/transport/peer_test.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

manager/state/raft/transport/transport_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func newSnapshotMessage(from uint64, to uint64) raftpb.Message {
2222
Type: raftpb.MsgSnap,
2323
From: from,
2424
To: to,
25-
Snapshot: raftpb.Snapshot{
25+
Snapshot: &raftpb.Snapshot{
2626
Data: data,
2727
// Include the snapshot size in the Index field for testing.
2828
Metadata: raftpb.SnapshotMetadata{

0 commit comments

Comments
 (0)