Documentation ¶
Overview ¶
Package testrand implements generating random base types for testing.
Index ¶
- func BucketName() string
- func Bytes(size memory.Size) []byte
- func BytesInt(size int) []byte
- func Float64n(n int64) float64
- func Int63n(n int64) int64
- func Intn(n int) int
- func Key() storj.Key
- func Metadata() map[string]string
- func NodeID() storj.NodeID
- func Nonce() storj.Nonce
- func Path() string
- func PieceID() storj.PieceID
- func Read(data []byte)
- func Reader() io.Reader
- func SegmentID(size int) storj.SegmentID
- func SerialNumber() storj.SerialNumber
- func StreamID(size int) storj.StreamID
- func UUID() uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketName ¶
func BucketName() string
BucketName creates a random bucket name mostly confirming to the restrictions of S3: https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
NOTE: This may not generate values that cover all valid values (for Storj or S3). This is a best effort to cover most cases we believe our design requires and will need to be revisited when a more explicit design spec is created.
func Float64n ¶
Float64n returns floating point pseudo-random number in [-n,0] || [0,n] based on the sign of the input
func Int63n ¶
Int63n returns, as an int64, a non-negative pseudo-random number in [0,n) from the default Source. It panics if n <= 0.
func Intn ¶
Intn returns, as an int, a non-negative pseudo-random number in [0,n) from the default Source. It panics if n <= 0.
func Metadata ¶
Metadata creates random metadata mostly conforming to the restrictions of S3: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-metadata
NOTE: This may not generate values that cover all valid values (for Storj or S3). This is a best effort to cover most cases we believe our design requires and will need to be revisited when a more explicit design spec is created.
func Path ¶
func Path() string
Path creates a random path mostly conforming to the retrictions of S3: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys
NOTE: This may not generate values that cover all valid values (for Storj or S3). This is a best effort to cover most cases we believe our design requires and will need to be revisited when a more explicit design spec is created.
func SerialNumber ¶
func SerialNumber() storj.SerialNumber
SerialNumber creates a random serial number.
Types ¶
This section is empty.