[#956] policer/test: Reuse testPool helper

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-02-02 20:57:49 +03:00 committed by Evgenii Stratonikov
parent cbfeb72466
commit edbe06e07e

View file

@ -48,16 +48,12 @@ func TestBuryObjectWithoutContainer(t *testing.T) {
return nil
}
// Task pool
pool, err := ants.NewPool(4)
require.NoError(t, err)
// Policer instance
p := New(
WithKeySpaceIterator(&sliceKeySpaceIterator{objs: objs}),
WithContainerSource(containerSrc),
WithBuryFunc(buryFn),
WithPool(pool),
WithPool(testPool(t)),
)
ctx, cancel := context.WithCancel(context.Background())
@ -298,9 +294,6 @@ func TestIteratorContract(t *testing.T) {
return nil
}
pool, err := ants.NewPool(4)
require.NoError(t, err)
it := &predefinedIterator{
scenario: []nextResult{
{objs, nil},
@ -326,7 +319,7 @@ func TestIteratorContract(t *testing.T) {
WithKeySpaceIterator(it),
WithContainerSource(containerSrc),
WithBuryFunc(buryFn),
WithPool(pool),
WithPool(testPool(t)),
func(c *cfg) {
c.sleepDuration = time.Millisecond
},