Avoid using loop variable in test tasks

This commit is contained in:
Alex Vanin 2022-05-29 14:27:10 +03:00
parent 2b5b39e7b5
commit e476e8570a

View file

@ -94,7 +94,8 @@ func TestPriorityPool_Submit(t *testing.T) {
wg.Add(poolCap)
for i := 0; i < poolCap; i++ {
err = p.Submit(lowPriority, taskGenerator(i, nil, wg))
id := i
err = p.Submit(lowPriority, taskGenerator(id, nil, wg))
require.NoError(t, err)
}
@ -114,7 +115,8 @@ func TestPriorityPool_Submit(t *testing.T) {
wg.Add(n)
for i := 0; i < n; i++ {
err = p.Submit(lowPriority, taskGenerator(i, nil, wg))
id := i
err = p.Submit(lowPriority, taskGenerator(id, nil, wg))
require.NoError(t, err)
}