Browse Source

Merge pull request #1120 from prometheus/flaky-test

retrieval: Reduce flakiness of TestTargetRunScraperScrapes
pull/1116/head
Fabian Reinartz 9 years ago
parent
commit
097d810f37
  1. 6
      retrieval/target_test.go

6
retrieval/target_test.go

@ -357,17 +357,17 @@ func TestTargetRunScraperScrapes(t *testing.T) {
go testTarget.RunScraper(nopAppender{})
// Enough time for a scrape to happen.
time.Sleep(10 * time.Millisecond)
time.Sleep(20 * time.Millisecond)
if testTarget.status.LastScrape().IsZero() {
t.Errorf("Scrape hasn't occured.")
}
testTarget.StopScraper()
// Wait for it to take effect.
time.Sleep(5 * time.Millisecond)
time.Sleep(20 * time.Millisecond)
last := testTarget.status.LastScrape()
// Enough time for a scrape to happen.
time.Sleep(10 * time.Millisecond)
time.Sleep(20 * time.Millisecond)
if testTarget.status.LastScrape() != last {
t.Errorf("Scrape occured after it was stopped.")
}

Loading…
Cancel
Save