[#334] engine: Make tests more predictable

There is a codecov issue because objects are not placed
in the engine the same way every unit test. Therefore
sometimes there are more coverage, sometimes there are
less. Seeded RNG should solve this issue for engine tests.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-01-20 21:13:18 +03:00 committed by Alex Vanin
parent 6eb0706b08
commit e03d906cb7
4 changed files with 8 additions and 4 deletions

View file

@ -1,8 +1,8 @@
package blobovnicza package blobovnicza
import ( import (
"crypto/rand"
"crypto/sha256" "crypto/sha256"
"math/rand"
"os" "os"
"testing" "testing"
@ -70,6 +70,8 @@ func testGet(t *testing.T, blz *Blobovnicza, addr *objectSDK.Address, expObj []b
} }
func TestBlobovnicza(t *testing.T) { func TestBlobovnicza(t *testing.T) {
rand.Seed(1024)
p := "./test_blz" p := "./test_blz"
sizeLim := uint64(256 * 1 << 10) // 256KB sizeLim := uint64(256 * 1 << 10) // 256KB

View file

@ -1,9 +1,9 @@
package blobstor package blobstor
import ( import (
"crypto/rand"
"crypto/sha256" "crypto/sha256"
"errors" "errors"
"math/rand"
"os" "os"
"testing" "testing"
@ -55,6 +55,8 @@ func testObject(sz uint64) *object.Object {
} }
func TestBlobovniczas(t *testing.T) { func TestBlobovniczas(t *testing.T) {
rand.Seed(1024)
l := test.NewLogger(false) l := test.NewLogger(false)
p := "./test_blz" p := "./test_blz"

View file

@ -1,8 +1,8 @@
package meta_test package meta_test
import ( import (
"crypto/rand"
"crypto/sha256" "crypto/sha256"
"math/rand"
"os" "os"
"testing" "testing"

View file

@ -1,8 +1,8 @@
package shard_test package shard_test
import ( import (
"crypto/rand"
"crypto/sha256" "crypto/sha256"
"math/rand"
"os" "os"
"path" "path"
"testing" "testing"