From 0078166d452cad0feaa4818a645418d903f0f304 Mon Sep 17 00:00:00 2001 From: CharlesCheung Date: Wed, 18 May 2022 14:33:32 +0800 Subject: [PATCH] add some comments --- cdc/sink/mq/mq_flush_worker_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cdc/sink/mq/mq_flush_worker_test.go b/cdc/sink/mq/mq_flush_worker_test.go index 0c1b8421bbc..6ccbab3ab50 100644 --- a/cdc/sink/mq/mq_flush_worker_test.go +++ b/cdc/sink/mq/mq_flush_worker_test.go @@ -180,7 +180,6 @@ func TestBatch(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { // Can not be parallel, it tests reusing the same batch. - wg.Add(1) go func() { defer wg.Done() @@ -192,10 +191,11 @@ func TestBatch(t *testing.T) { go func() { for _, event := range test.events { err := worker.addEvent(ctx, event) - if event.row == nil || event.row.CommitTs != math.MaxUint64 { - require.NoError(t, err) - } else { + if event.row != nil && event.row.CommitTs == math.MaxUint64 { + // For unprocessed events, addEvent returns after ctx has been cancelled. require.Regexp(t, ".*context canceled.*", err) + } else { + require.NoError(t, err) } } }()