mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-14 02:33:03 +02:00
fix error in file test (#1483)
This commit is contained in:
parent
894fc1a058
commit
53563ab498
@ -299,11 +299,14 @@ func TestMergeDataRace(t *testing.T) {
|
||||
c := config.New(config.WithSource(
|
||||
NewSource(path),
|
||||
))
|
||||
const count = 80
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(2)
|
||||
startCh := make(chan struct{})
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 100; i++ {
|
||||
<-startCh
|
||||
for i := 0; i < count; i++ {
|
||||
var conf struct{}
|
||||
if err := c.Scan(&conf); err != nil {
|
||||
t.Error(err)
|
||||
@ -313,11 +316,13 @@ func TestMergeDataRace(t *testing.T) {
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 100; i++ {
|
||||
<-startCh
|
||||
for i := 0; i < count; i++ {
|
||||
if err := c.Load(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
close(startCh)
|
||||
wg.Wait()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user