[#xxx] pool: Add test for concurrent client deletion
Some checks failed
DCO / DCO (pull_request) Failing after 30s
Code generation / Generate proto (pull_request) Successful in 35s
Tests and linters / Tests (pull_request) Successful in 45s
Tests and linters / Lint (pull_request) Successful in 2m17s

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2025-01-29 20:12:54 +03:00
parent 8293d17627
commit 46213d1f17

View file

@ -10,6 +10,7 @@ import (
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
"git.frostfs.info/TrueCloudLab/hrw"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
@ -416,6 +417,20 @@ func TestRetryContainerNodes(t *testing.T) {
})
}
func TestDeleteClientTwice(t *testing.T) {
p := Pool{
clientMap: makeClientMap([]netmap.NodeInfo{netmaptest.NodeInfo()}),
}
// emulate concurrent request as consecutive requests
// to delete the same client id from the map twice
for idToDelete := range p.clientMap {
p.deleteClientFromMap(idToDelete)
require.NotPanics(t, func() {
p.deleteClientFromMap(idToDelete)
})
}
}
func makeInnerPool(nodes [][]string) []*innerPool {
res := make([]*innerPool, len(nodes))