testrand

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testrand implements generating random base types for testing.

Index

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 Bytes

func Bytes(size memory.Size) []byte

Bytes generates size amount of random data.

func BytesInt

func BytesInt(size int) []byte

BytesInt generates size amount of random data.

func Float64n

func Float64n(n int64) float64

Float64n returns floating point pseudo-random number in [-n,0] || [0,n] based on the sign of the input

func Int63n

func Int63n(n int64) int64

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

func Intn(n int) int

Intn returns, as an int, a non-negative pseudo-random number in [0,n) from the default Source. It panics if n <= 0.

func Key

func Key() storj.Key

Key creates a random test key.

func Metadata

func Metadata() map[string]string

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 NodeID

func NodeID() storj.NodeID

NodeID creates a random node id.

func Nonce

func Nonce() storj.Nonce

Nonce creates a random test nonce.

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 PieceID

func PieceID() storj.PieceID

PieceID creates a random piece id.

func Read

func Read(data []byte)

Read reads pseudo-random data into data.

func Reader

func Reader() io.Reader

Reader creates a new random data reader.

func SegmentID

func SegmentID(size int) storj.SegmentID

SegmentID creates a random segment ID

func SerialNumber

func SerialNumber() storj.SerialNumber

SerialNumber creates a random serial number.

func StreamID

func StreamID(size int) storj.StreamID

StreamID creates a random stream ID

func UUID

func UUID() uuid.UUID

UUID creates a random uuid.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL