forked from TrueCloudLab/frostfs-node
[#674] storage engine: Fix unit test failed on shard pool NPE
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2126235f0e
commit
43ccab3294
1 changed files with 11 additions and 2 deletions
|
@ -16,8 +16,10 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
||||||
|
"github.com/nspcc-dev/neofs-node/pkg/util"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/util/test"
|
"github.com/nspcc-dev/neofs-node/pkg/util/test"
|
||||||
"github.com/nspcc-dev/tzhash/tz"
|
"github.com/nspcc-dev/tzhash/tz"
|
||||||
|
"github.com/panjf2000/ants/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -29,10 +31,17 @@ func testNewEngineWithShards(shards ...*shard.Shard) *StorageEngine {
|
||||||
},
|
},
|
||||||
mtx: new(sync.RWMutex),
|
mtx: new(sync.RWMutex),
|
||||||
shards: make(map[string]*shard.Shard, len(shards)),
|
shards: make(map[string]*shard.Shard, len(shards)),
|
||||||
|
shardPools: make(map[string]util.WorkerPool, len(shards)),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range shards {
|
for _, s := range shards {
|
||||||
|
pool, err := ants.NewPool(10, ants.WithNonblocking(true))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
engine.shards[s.ID().String()] = s
|
engine.shards[s.ID().String()] = s
|
||||||
|
engine.shardPools[s.ID().String()] = pool
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine
|
return engine
|
||||||
|
|
Loading…
Reference in a new issue