[#236] testutil: Use random object id in `RandObjGenerator`

Before this commit it was like this:
```
BenchmarkSubstorageWritePerf/memstore-rand10-8            227425              4859 ns/op
BenchmarkSubstorageWritePerf/fstree_nosync-rand10-8     --- FAIL: BenchmarkSubstorageWritePerf/fstree_nosync-rand10-8
    perf_test.go:165: writing entry: file exists
    perf_test.go:165: writing entry: file exists
    perf_test.go:165: writing entry: file exists
BenchmarkSubstorageWritePerf/fstree-rand10-8            --- FAIL: BenchmarkSubstorageWritePerf/fstree-rand10-8
    perf_test.go:165: writing entry: file exists
    perf_test.go:165: writing entry: file exists
    perf_test.go:165: writing entry: file exists
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
pull/236/head
Evgenii Stratonikov 2023-04-11 20:30:27 +03:00
parent c85a0bc866
commit 6ad5c38225
1 changed files with 3 additions and 1 deletions

View File

@ -81,7 +81,9 @@ type RandObjGenerator struct {
var _ ObjectGenerator = &RandObjGenerator{}
func (g *RandObjGenerator) Next() *object.Object {
return generateObjectWithOIDWithCIDWithSize(oid.ID{}, cid.ID{}, g.ObjSize)
var id oid.ID
rand.Read(id[:])
return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize)
}
// OverwriteObjGenerator is an ObjectGenerator that generates entries with random payloads of size objSize and at most maxObjects distinct IDs.