WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
Showing only changes of commit c6df6c84ae - Show all commits

View file

@ -97,10 +97,16 @@ func NewTraverser(opts ...Option) (*Traverser, error) {
} else { } else {
rem = defaultCopiesVector(cfg.policy) rem = defaultCopiesVector(cfg.policy)
// compatibleZeroVector is a bool flag which is set when cfg.copyNumbers
// is [0]. In this case we should not modify `rem` slice unless track
// copies are ignored, because [0] means that all copies should be
// stored before returning OK to the client.
compatibleZeroVector := len(cfg.copyNumbers) == 1 && cfg.copyNumbers[0] == 0
for i := range rem { for i := range rem {
if !cfg.trackCopies { if !cfg.trackCopies {
rem[i] = -1 rem[i] = -1
} else if len(cfg.copyNumbers) > i { } else if len(cfg.copyNumbers) > i && !compatibleZeroVector {
rem[i] = int(cfg.copyNumbers[i]) rem[i] = int(cfg.copyNumbers[i])
} }
} }