scrape_test: fix send-to-closed-channel bugs (#6849)

Signed-off-by: BurtonQin <bobbqqin@gmail.com>
This commit is contained in:
Boqin Qin 2020-02-20 21:40:25 +08:00 committed by GitHub
parent d276b5fb65
commit 0e51cf65e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -432,7 +432,6 @@ func TestScrapeLoopStop(t *testing.T) {
scraper = &testScraper{}
app = func() storage.Appender { return appender }
)
defer close(signal)
sl := newScrapeLoop(context.Background(),
scraper,
@ -498,7 +497,6 @@ func TestScrapeLoopRun(t *testing.T) {
scraper = &testScraper{}
app = func() storage.Appender { return &nopAppender{} }
)
defer close(signal)
ctx, cancel := context.WithCancel(context.Background())
sl := newScrapeLoop(ctx,
@ -679,7 +677,6 @@ func TestScrapeLoopRunCreatesStaleMarkersOnFailedScrape(t *testing.T) {
scraper = &testScraper{}
app = func() storage.Appender { return appender }
)
defer close(signal)
ctx, cancel := context.WithCancel(context.Background())
sl := newScrapeLoop(ctx,
@ -734,7 +731,6 @@ func TestScrapeLoopRunCreatesStaleMarkersOnParseFailure(t *testing.T) {
app = func() storage.Appender { return appender }
numScrapes = 0
)
defer close(signal)
ctx, cancel := context.WithCancel(context.Background())
sl := newScrapeLoop(ctx,
@ -795,7 +791,6 @@ func TestScrapeLoopCache(t *testing.T) {
scraper = &testScraper{}
app = func() storage.Appender { return appender }
)
defer close(signal)
ctx, cancel := context.WithCancel(context.Background())
sl := newScrapeLoop(ctx,
@ -872,7 +867,6 @@ func TestScrapeLoopCacheMemoryExhaustionProtection(t *testing.T) {
scraper = &testScraper{}
app = func() storage.Appender { return appender }
)
defer close(signal)
ctx, cancel := context.WithCancel(context.Background())
sl := newScrapeLoop(ctx,