[#1085] shard/test: add object integrity check for `Evacuate`

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
remotes/fyrchik/fix-config-wc
Evgenii Stratonikov 2022-01-18 17:07:30 +03:00 committed by LeL
parent c0f6c988f0
commit b432ec3a03
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"errors"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"testing"
@ -77,6 +78,7 @@ func testEvacuate(t *testing.T, objCount int, hasWriteCache bool) {
size = bsBigObjectSize - headerSize
}
data := make([]byte, size)
rand.Read(data)
obj := generateRawObjectWithPayload(cid, data)
objects[i] = obj.Object()
@ -212,7 +214,8 @@ func checkRestore(t *testing.T, sh *shard.Shard, prm *shard.RestorePrm, objects
require.Equal(t, len(objects), res.Count())
for i := range objects {
_, err := sh.Get(new(shard.GetPrm).WithAddress(objects[i].Address()))
res, err := sh.Get(new(shard.GetPrm).WithAddress(objects[i].Address()))
require.NoError(t, err)
require.Equal(t, objects[i], res.Object())
}
}