add proper exit for loop

Signed-off-by: Shihao Xia <charlesxsh@hotmail.com>
This commit is contained in:
Shihao Xia 2021-12-29 23:48:11 -05:00
parent c92673fb14
commit c3e7bfb813
1 changed files with 8 additions and 0 deletions

View File

@ -356,6 +356,7 @@ func TestReshardRaceWithStop(t *testing.T) {
cfg := config.DefaultQueueConfig
mcfg := config.DefaultMetadataConfig
exitCh := make(chan struct{})
go func() {
for {
metrics := newQueueManagerMetrics(nil, "", "")
@ -364,6 +365,12 @@ func TestReshardRaceWithStop(t *testing.T) {
h.Unlock()
h.Lock()
m.Stop()
select {
case exitCh <- struct{}{}:
return
default:
}
}
}()
@ -372,6 +379,7 @@ func TestReshardRaceWithStop(t *testing.T) {
m.reshardChan <- i
h.Unlock()
}
<-exitCh
}
func TestReleaseNoninternedString(t *testing.T) {