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)),
|
labels: labels.FromStrings(model.AddressLabel, fmt.Sprintf("example.com:%d", i)),
|
||||||
}
|
}
|
||||||
l := &testLoop{}
|
l := &testLoop{}
|
||||||
|
d := time.Duration((i+1)*20) * time.Millisecond
|
||||||
l.stopFunc = func() {
|
l.stopFunc = func() {
|
||||||
time.Sleep(time.Duration(i*20) * time.Millisecond)
|
time.Sleep(d)
|
||||||
|
|
||||||
mtx.Lock()
|
mtx.Lock()
|
||||||
stopped[t.hash()] = true
|
stopped[t.hash()] = true
|
||||||
@ -273,8 +274,9 @@ func TestScrapePoolReload(t *testing.T) {
|
|||||||
discoveredLabels: labels,
|
discoveredLabels: labels,
|
||||||
}
|
}
|
||||||
l := &testLoop{}
|
l := &testLoop{}
|
||||||
|
d := time.Duration((i+1)*20) * time.Millisecond
|
||||||
l.stopFunc = func() {
|
l.stopFunc = func() {
|
||||||
time.Sleep(time.Duration(i*20) * time.Millisecond)
|
time.Sleep(d)
|
||||||
|
|
||||||
mtx.Lock()
|
mtx.Lock()
|
||||||
stopped[t.hash()] = true
|
stopped[t.hash()] = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user