Skip to content

Commit

Permalink
redo(ticdc): Fix RedoLogWriter unit test (#11853) (#11940)
Browse files Browse the repository at this point in the history
close #11852
  • Loading branch information
ti-chi-bot authored Dec 27, 2024
1 parent 46a22f7 commit 8f22567
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions cdc/redo/writer/memory/mem_log_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,30 @@ func testWriteEvents(t *testing.T, events []writer.RedoEvent) {

functions := map[string]func(error){
"WriteEvents": func(expected error) {
err := lw.WriteEvents(ctx, events...)
require.ErrorIs(t, errors.Cause(err), expected)
if expected == nil {
err := lw.WriteEvents(ctx, events...)
require.NoError(t, err)
} else {
require.Eventually(
t, func() bool {
err := lw.WriteEvents(ctx, events...)
return errors.Is(errors.Cause(err), expected)
}, time.Second*2, time.Microsecond*10,
)
}
},
"FlushLog": func(expected error) {
err := lw.FlushLog(ctx)
require.ErrorIs(t, errors.Cause(err), expected)
if expected == nil {
err := lw.FlushLog(ctx)
require.NoError(t, err)
} else {
require.Eventually(
t, func() bool {
err := lw.WriteEvents(ctx, events...)
return errors.Is(errors.Cause(err), expected)
}, time.Second*2, time.Microsecond*10,
)
}
},
}
firstCall := true
Expand Down

0 comments on commit 8f22567

Please sign in to comment.