From b432ec3a03f139ad7955f30fb420258fab6a38b9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 18 Jan 2022 17:07:30 +0300 Subject: [PATCH] [#1085] shard/test: add object integrity check for `Evacuate` Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/shard/evacuate_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/local_object_storage/shard/evacuate_test.go b/pkg/local_object_storage/shard/evacuate_test.go index 7c5c2b20f..4cef3ceb8 100644 --- a/pkg/local_object_storage/shard/evacuate_test.go +++ b/pkg/local_object_storage/shard/evacuate_test.go @@ -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()) } }