@@ -356,7 +356,7 @@ func benchmarkFetchAndSetScope(b *testing.B, size int) {
356
356
db := NewTestDB ()
357
357
ctx := context .TODO ()
358
358
359
- keys , vals := initializeSet (size )
359
+ keys , vals := initializeSet (require , size )
360
360
for i , key := range keys {
361
361
err := db .Insert (ctx , key , vals [i ])
362
362
require .NoError (err , "Error during insert." )
@@ -376,7 +376,7 @@ func benchmarkInsert(b *testing.B, size int) {
376
376
ts := New (size )
377
377
ctx := context .TODO ()
378
378
379
- keys , vals := initializeSet (size )
379
+ keys , vals := initializeSet (require , size )
380
380
381
381
storage := map [string ][]byte {}
382
382
for i , key := range keys {
@@ -401,7 +401,7 @@ func benchmarkGetValue(b *testing.B, size int) {
401
401
ts := New (size )
402
402
ctx := context .TODO ()
403
403
404
- keys , vals := initializeSet (size )
404
+ keys , vals := initializeSet (require , size )
405
405
406
406
storage := map [string ][]byte {}
407
407
for i , key := range keys {
@@ -421,20 +421,21 @@ func benchmarkGetValue(b *testing.B, size int) {
421
421
b .StopTimer ()
422
422
}
423
423
424
- func initializeSet (size int ) ([][]byte , [][]byte ) {
424
+ func initializeSet (r * require. Assertions , size int ) ([][]byte , [][]byte ) {
425
425
keys := [][]byte {}
426
426
vals := [][]byte {}
427
427
428
428
for i := 0 ; i <= size ; i ++ {
429
- keys = append (keys , randomBytes (33 ))
430
- vals = append (vals , randomBytes (8 ))
429
+ keys = append (keys , randomBytes (r , 65 ))
430
+ vals = append (vals , randomBytes (r , 8 ))
431
431
}
432
432
433
433
return keys , vals
434
434
}
435
435
436
- func randomBytes (size int ) []byte {
436
+ func randomBytes (r * require. Assertions , size int ) []byte {
437
437
bytes := make ([]byte , size )
438
- rand .Read (bytes )
438
+ _ , err := rand .Read (bytes )
439
+ r .NoError (err )
439
440
return bytes
440
441
}
0 commit comments