mirror of
https://github.com/distribution/distribution.git
synced 2025-09-11 03:39:41 +00:00
testutil, storage: use math/rand.Read where possible
Use the much faster math/rand.Read function where cryptographic guarantees are not required. The unit test suite should speed up a little bit but we've already optimized around this, so it may not matter. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -2,7 +2,6 @@ package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"io"
|
||||
mrand "math/rand"
|
||||
"os"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
func TestSimpleRead(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
content := make([]byte, 1<<20)
|
||||
n, err := rand.Read(content)
|
||||
n, err := mrand.Read(content)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error building random data: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user