mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 14:27:27 -08:00
discovery/consul: fix leaking goroutine from test
Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
This commit is contained in:
parent
d8561dbfd8
commit
0bfef847b0
|
@ -307,11 +307,15 @@ func TestNoTargets(t *testing.T) {
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
ch := make(chan []*targetgroup.Group)
|
ch := make(chan []*targetgroup.Group)
|
||||||
go d.Run(ctx, ch)
|
go func() {
|
||||||
|
d.Run(ctx, ch)
|
||||||
|
close(ch)
|
||||||
|
}()
|
||||||
|
|
||||||
targets := (<-ch)[0].Targets
|
targets := (<-ch)[0].Targets
|
||||||
require.Equal(t, 0, len(targets))
|
require.Equal(t, 0, len(targets))
|
||||||
cancel()
|
cancel()
|
||||||
|
<-ch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch only the test service.
|
// Watch only the test service.
|
||||||
|
|
Loading…
Reference in a new issue