forked from TrueCloudLab/frostfs-node
[#1604] policer/test: Add test for MAINTENANCE runtime status
The node can have MAINTENANCE status in the network map, but can also be ONLINE while responding with MAINTENANCE. These are 2 different code paths, let's test them separately. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
4538ccb12a
commit
26e0c82fb8
1 changed files with 14 additions and 0 deletions
|
@ -78,6 +78,7 @@ func TestProcessObject(t *testing.T) {
|
||||||
maintenanceNodes []int
|
maintenanceNodes []int
|
||||||
wantRemoveRedundant bool
|
wantRemoveRedundant bool
|
||||||
wantReplicateTo []int
|
wantReplicateTo []int
|
||||||
|
headResult map[int]error
|
||||||
ecInfo *objectcore.ECInfo
|
ecInfo *objectcore.ECInfo
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -145,6 +146,14 @@ func TestProcessObject(t *testing.T) {
|
||||||
objHolders: []int{1},
|
objHolders: []int{1},
|
||||||
maintenanceNodes: []int{2},
|
maintenanceNodes: []int{2},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
desc: "preserve local copy when node response with MAINTENANCE",
|
||||||
|
nodeCount: 3,
|
||||||
|
policy: `REP 2`,
|
||||||
|
placement: [][]int{{1, 2}},
|
||||||
|
objHolders: []int{1},
|
||||||
|
headResult: map[int]error{2: new(apistatus.NodeUnderMaintenance)},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
desc: "lock object must be replicated to all EC nodes",
|
desc: "lock object must be replicated to all EC nodes",
|
||||||
objType: objectSDK.TypeLock,
|
objType: objectSDK.TypeLock,
|
||||||
|
@ -204,6 +213,11 @@ func TestProcessObject(t *testing.T) {
|
||||||
t.Errorf("unexpected remote object head: node=%+v addr=%v", ni, a)
|
t.Errorf("unexpected remote object head: node=%+v addr=%v", ni, a)
|
||||||
return nil, errors.New("unexpected object head")
|
return nil, errors.New("unexpected object head")
|
||||||
}
|
}
|
||||||
|
if ti.headResult != nil {
|
||||||
|
if err, ok := ti.headResult[index]; ok {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, i := range ti.objHolders {
|
for _, i := range ti.objHolders {
|
||||||
if index == i {
|
if index == i {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue