mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
add proper exit for loop
Signed-off-by: Shihao Xia <charlesxsh@hotmail.com>
This commit is contained in:
parent
c92673fb14
commit
c3e7bfb813
|
@ -356,6 +356,7 @@ func TestReshardRaceWithStop(t *testing.T) {
|
||||||
|
|
||||||
cfg := config.DefaultQueueConfig
|
cfg := config.DefaultQueueConfig
|
||||||
mcfg := config.DefaultMetadataConfig
|
mcfg := config.DefaultMetadataConfig
|
||||||
|
exitCh := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
metrics := newQueueManagerMetrics(nil, "", "")
|
metrics := newQueueManagerMetrics(nil, "", "")
|
||||||
|
@ -364,6 +365,12 @@ func TestReshardRaceWithStop(t *testing.T) {
|
||||||
h.Unlock()
|
h.Unlock()
|
||||||
h.Lock()
|
h.Lock()
|
||||||
m.Stop()
|
m.Stop()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case exitCh <- struct{}{}:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -372,6 +379,7 @@ func TestReshardRaceWithStop(t *testing.T) {
|
||||||
m.reshardChan <- i
|
m.reshardChan <- i
|
||||||
h.Unlock()
|
h.Unlock()
|
||||||
}
|
}
|
||||||
|
<-exitCh
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReleaseNoninternedString(t *testing.T) {
|
func TestReleaseNoninternedString(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue