Increase target test wait times

On slow systems such as Travis CI occasionally the tests fail
because the wait times are too short.
This commit is contained in:
Fabian Reinartz 2015-05-19 11:30:42 +02:00
parent 2843ff6a0d
commit 8de50619f1
1 changed files with 5 additions and 5 deletions

View File

@ -135,7 +135,7 @@ func TestTargetScrapeTimeout(t *testing.T) {
) )
defer server.Close() defer server.Close()
testTarget := newTestTarget(server.URL, 10*time.Millisecond, clientmodel.LabelSet{}) testTarget := newTestTarget(server.URL, 25*time.Millisecond, clientmodel.LabelSet{})
appender := nopAppender{} appender := nopAppender{}
@ -146,7 +146,7 @@ func TestTargetScrapeTimeout(t *testing.T) {
} }
// let the deadline lapse // let the deadline lapse
time.Sleep(15 * time.Millisecond) time.Sleep(30 * time.Millisecond)
// now scrape again // now scrape again
signal <- true signal <- true
@ -194,17 +194,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(2 * time.Millisecond) time.Sleep(10 * 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(2 * time.Millisecond) time.Sleep(5 * 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(2 * time.Millisecond) time.Sleep(10 * 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.")
} }