From 9adddbceea03780e84bb6a31ad96543eefbdfbe5 Mon Sep 17 00:00:00 2001 From: Rueian Date: Thu, 8 Feb 2024 00:40:33 +0800 Subject: [PATCH] test: skip block check if no deplay after flush --- pipe_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pipe_test.go b/pipe_test.go index f71aff2e..8f5922e6 100644 --- a/pipe_test.go +++ b/pipe_test.go @@ -815,6 +815,31 @@ func TestWriteWithMaxFlushDelay(t *testing.T) { } } +func TestBlockWriteWithNoMaxFlushDelay(t *testing.T) { + defer ShouldNotLeaked(SetupLeakDetection()) + p, mock, cancel, _ := setup(t, ClientOption{ + AlwaysPipelining: true, + MaxFlushDelay: 20 * time.Microsecond, + }) + defer cancel() + times := 2000 + wg := sync.WaitGroup{} + wg.Add(times) + + for i := 0; i < times; i++ { + go func() { + for _, resp := range p.DoMulti(context.Background(), + cmds.NewBlockingCompleted([]string{"PING"}), + cmds.NewBlockingCompleted([]string{"PING"})).s { + ExpectOK(t, resp) + } + }() + } + for i := 0; i < times; i++ { + mock.Expect("PING").ReplyString("OK").Expect("PING").ReplyString("OK") + } +} + func TestWriteMultiFlush(t *testing.T) { defer ShouldNotLeaked(SetupLeakDetection()) p, mock, cancel, _ := setup(t, ClientOption{})