mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #12296 from rsc/loopvar
scrape: fix two loop variable scoping bugs in test
This commit is contained in:
commit
24d7e5bd49
|
@ -190,8 +190,9 @@ func TestScrapePoolStop(t *testing.T) {
|
|||
labels: labels.FromStrings(model.AddressLabel, fmt.Sprintf("example.com:%d", i)),
|
||||
}
|
||||
l := &testLoop{}
|
||||
d := time.Duration((i+1)*20) * time.Millisecond
|
||||
l.stopFunc = func() {
|
||||
time.Sleep(time.Duration(i*20) * time.Millisecond)
|
||||
time.Sleep(d)
|
||||
|
||||
mtx.Lock()
|
||||
stopped[t.hash()] = true
|
||||
|
@ -273,8 +274,9 @@ func TestScrapePoolReload(t *testing.T) {
|
|||
discoveredLabels: labels,
|
||||
}
|
||||
l := &testLoop{}
|
||||
d := time.Duration((i+1)*20) * time.Millisecond
|
||||
l.stopFunc = func() {
|
||||
time.Sleep(time.Duration(i*20) * time.Millisecond)
|
||||
time.Sleep(d)
|
||||
|
||||
mtx.Lock()
|
||||
stopped[t.hash()] = true
|
||||
|
|
Loading…
Reference in a new issue