diff --git a/refs/test/generate.go b/refs/test/generate.go index 6217a96..d74963e 100644 --- a/refs/test/generate.go +++ b/refs/test/generate.go @@ -1,6 +1,8 @@ package refstest import ( + crand "crypto/rand" + "crypto/sha256" "math/rand" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" @@ -21,7 +23,10 @@ func GenerateOwnerID(empty bool) *refs.OwnerID { m := new(refs.OwnerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, 25) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -42,7 +47,10 @@ func GenerateObjectID(empty bool) *refs.ObjectID { m := new(refs.ObjectID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -65,7 +73,10 @@ func GenerateContainerID(empty bool) *refs.ContainerID { m := new(refs.ContainerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + id := make([]byte, sha256.Size) + _, _ = crand.Read(id) + + m.SetValue(id) } return m @@ -100,8 +111,11 @@ func GenerateChecksum(empty bool) *refs.Checksum { m := new(refs.Checksum) if !empty { - m.SetType(1) - m.SetSum([]byte{1, 2, 3}) + cs := make([]byte, sha256.Size) + _, _ = crand.Read(cs) + + m.SetType(refs.SHA256) + m.SetSum(cs) } return m