mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 15:44:05 -08:00
Merge pull request #1120 from prometheus/flaky-test
retrieval: Reduce flakiness of TestTargetRunScraperScrapes
This commit is contained in:
commit
097d810f37
|
@ -357,17 +357,17 @@ func TestTargetRunScraperScrapes(t *testing.T) {
|
||||||
go testTarget.RunScraper(nopAppender{})
|
go testTarget.RunScraper(nopAppender{})
|
||||||
|
|
||||||
// Enough time for a scrape to happen.
|
// Enough time for a scrape to happen.
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(20 * time.Millisecond)
|
||||||
if testTarget.status.LastScrape().IsZero() {
|
if testTarget.status.LastScrape().IsZero() {
|
||||||
t.Errorf("Scrape hasn't occured.")
|
t.Errorf("Scrape hasn't occured.")
|
||||||
}
|
}
|
||||||
|
|
||||||
testTarget.StopScraper()
|
testTarget.StopScraper()
|
||||||
// Wait for it to take effect.
|
// Wait for it to take effect.
|
||||||
time.Sleep(5 * time.Millisecond)
|
time.Sleep(20 * time.Millisecond)
|
||||||
last := testTarget.status.LastScrape()
|
last := testTarget.status.LastScrape()
|
||||||
// Enough time for a scrape to happen.
|
// Enough time for a scrape to happen.
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(20 * time.Millisecond)
|
||||||
if testTarget.status.LastScrape() != last {
|
if testTarget.status.LastScrape() != last {
|
||||||
t.Errorf("Scrape occured after it was stopped.")
|
t.Errorf("Scrape occured after it was stopped.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue