From bfc9e47e2c74557486d406daca4e3c1c1f6ab9fb Mon Sep 17 00:00:00 2001 From: sunby Date: Fri, 15 Oct 2021 15:56:35 +0800 Subject: [PATCH] Fix data race in datacoord test (#9936) issue: #9935 Signed-off-by: sunby --- internal/datacoord/server_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/datacoord/server_test.go b/internal/datacoord/server_test.go index ea20d68887..bddbc852d6 100644 --- a/internal/datacoord/server_test.go +++ b/internal/datacoord/server_test.go @@ -573,7 +573,10 @@ func TestGetFlushedSegments(t *testing.T) { } func TestService_WatchServices(t *testing.T) { - svr := newTestServer(t, nil) + factory := msgstream.NewPmsFactory() + svr, err := CreateServer(context.TODO(), factory) + assert.Nil(t, err) + svr.serverLoopWg.Add(1) ech := make(chan *sessionutil.SessionEvent) svr.eventCh = ech @@ -596,6 +599,8 @@ func TestService_WatchServices(t *testing.T) { flag = false svr.eventCh = ech ctx, cancel := context.WithCancel(context.Background()) + svr.serverLoopWg.Add(1) + go func() { svr.startWatchService(ctx) flag = true