mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: Wait check node id goroutine in case of data race (#36302)
Resolves: #36301 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
e013ef1908
commit
c0317ce672
@ -21,6 +21,7 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
@ -104,8 +105,11 @@ func (s *MiniClusterSuite) SetupTest() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Cluster = c
|
s.Cluster = c
|
||||||
|
|
||||||
|
checkWg := sync.WaitGroup{}
|
||||||
|
checkWg.Add(1)
|
||||||
// start mini cluster
|
// start mini cluster
|
||||||
nodeIDCheckReport := func() {
|
nodeIDCheckReport := func() {
|
||||||
|
defer checkWg.Done()
|
||||||
timeoutCtx, cancelFunc := context.WithTimeout(ctx, 5*time.Second)
|
timeoutCtx, cancelFunc := context.WithTimeout(ctx, 5*time.Second)
|
||||||
defer cancelFunc()
|
defer cancelFunc()
|
||||||
|
|
||||||
@ -124,6 +128,7 @@ func (s *MiniClusterSuite) SetupTest() {
|
|||||||
}
|
}
|
||||||
go nodeIDCheckReport()
|
go nodeIDCheckReport()
|
||||||
s.Require().NoError(s.Cluster.Start())
|
s.Require().NoError(s.Cluster.Start())
|
||||||
|
checkWg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MiniClusterSuite) TearDownTest() {
|
func (s *MiniClusterSuite) TearDownTest() {
|
||||||
|
Loading…
Reference in New Issue
Block a user