commit
fa82c65d15
|
@ -506,7 +506,7 @@ func TestTargetScrapeScrapeCancel(t *testing.T) {
|
|||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
done := make(chan struct{})
|
||||
errc := make(chan error)
|
||||
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
|
@ -515,15 +515,18 @@ func TestTargetScrapeScrapeCancel(t *testing.T) {
|
|||
|
||||
go func() {
|
||||
if _, err := ts.scrape(ctx, time.Now()); err != context.Canceled {
|
||||
t.Fatalf("Expected context cancelation error but got: %s", err)
|
||||
errc <- fmt.Errorf("Expected context cancelation error but got: %s", err)
|
||||
}
|
||||
close(done)
|
||||
close(errc)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatalf("Scrape function did not return unexpectedly")
|
||||
case <-done:
|
||||
case err := <-errc:
|
||||
if err != nil {
|
||||
t.Fatalf(err.Error())
|
||||
}
|
||||
}
|
||||
// If this is closed in a defer above the function the test server
|
||||
// does not terminate and the test doens't complete.
|
||||
|
|
|
@ -1097,11 +1097,12 @@ func TestQuranatineSeriesFile(t *testing.T) {
|
|||
t.Errorf("Unexpected state of quarantined file %q. Expected it to exist: %t. os.Stat returned: %s.", quarantinedFile, seriesFileShouldExist, err)
|
||||
}
|
||||
f, err := os.Open(hintFile)
|
||||
defer f.Close()
|
||||
if err != nil {
|
||||
t.Errorf("Could not open hint file %q: %s", hintFile, err)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
scanner := bufio.NewScanner(f)
|
||||
for _, want := range contentHintFile {
|
||||
if !scanner.Scan() {
|
||||
|
|
Loading…
Reference in New Issue