From 36cf3d55a4e42a5ce0c8df02c5b11dc3ecb36d7a Mon Sep 17 00:00:00 2001 From: lipandeng Date: Sat, 14 Dec 2024 00:38:16 +0800 Subject: [PATCH] feat: fix TestNewStreamCopy's data race --- schema/stream_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/stream_test.go b/schema/stream_test.go index 1d14c6c..c1b8389 100644 --- a/schema/stream_test.go +++ b/schema/stream_test.go @@ -321,7 +321,10 @@ func TestNewStreamCopy(t *testing.T) { wgEven.Wait() memo := copies[0].csr.parent.mem - assert.Equal(t, m/2, memo.closedNum) + memo.mu.Lock() + closedNum := memo.closedNum + memo.mu.Unlock() + assert.Equal(t, m/2, closedNum) wg.Wait() assert.Equal(t, m, memo.closedNum)