Documentation ¶
Overview ¶
- Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Package tutils provides common low-level utilities for all aistore unit and integration tests
FIXME -- FIXME: split and transform it into the: a) client API and b) test utilities FIXME -- FIXME: the client API must then move into the api package * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Package tutils provides common low-level utilities for all aistore unit and integration tests
- Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Package tutils provides common low-level utilities for all aistore unit and integration tests
- Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Package tutils provides common low-level utilities for all aistore unit and integration tests
- Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Package tutils provides common low-level utilities for all aistore unit and integration tests
- Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. *
Index ¶
- Constants
- Variables
- func AbortDSort(proxyURL, managerUUID string) error
- func BaseAPIParams(url string) *api.BaseParams
- func CheckFatal(err error, t *testing.T)
- func ClusterCount() int
- func ConnectContainer(containerID string, networks []string) error
- func ContainerCount(clusterNumber ...int) (proxyCnt int, targetCnt int)
- func ContainerExec(containerName string, args ...string) error
- func CreateFreshLocalBucket(t *testing.T, proxyURL, bucketFQN string)
- func CreateTarWithCustomFiles(tarName string, fileCnt, fileSize int, customFileType string, ...) error
- func CreateTarWithRandomFiles(tarName string, gzipped bool, fileCnt int, fileSize int) error
- func CreateZipWithRandomFiles(zipName string, fileCnt, fileSize int) error
- func DefaultBaseAPIParams(t *testing.T) *api.BaseParams
- func Del(proxyURL, bucket string, object string, wg *sync.WaitGroup, errCh chan error, ...) error
- func DeleteList(proxyURL, bucket string, fileslist []string, wait bool, deadline time.Duration) error
- func DeleteRange(proxyURL, bucket, prefix, regex, rng string, wait bool, deadline time.Duration) error
- func DestroyLocalBucket(t *testing.T, proxyURL, bucket string)
- func DisconnectContainer(containerID string) ([]string, error)
- func DockerCreateMpathDir(c int, mpathFQN string) (err error)
- func DockerRemoveMpathDir(c int, mpathFQN string) (err error)
- func DockerRunning() bool
- func DoesLocalBucketExist(serverURL string, bucket string) (bool, error)
- func EvictList(proxyURL, bucket string, fileslist []string, wait bool, deadline time.Duration) error
- func EvictRange(proxyURL, bucket, prefix, regex, rng string, wait bool, deadline time.Duration) error
- func FastRandomFilename(src *rand.Rand, fnlen int) string
- func GetFileInfosFromTarBuffer(buffer bytes.Buffer, gzipped bool) ([]os.FileInfo, error)
- func GetFileInfosFromZipBuffer(buffer bytes.Buffer) ([]os.FileInfo, error)
- func GetPrimaryProxy(proxyURL string) (string, error)
- func GetWhatRawQuery(getWhat string, getProps string) string
- func GetXactionResponse(proxyURL string, kind string) ([]byte, error)
- func IsCached(proxyURL, bucket, objname string) (bool, error)
- func ListObjects(proxyURL, bucket, prefix string, objectCountLimit int) ([]string, error)
- func Logf(msg string, args ...interface{})
- func Logln(msg string)
- func MetricsDSort(proxyURL, managerUUID string) (map[string]*dsort.Metrics, error)
- func ParseEnvVariables(fpath string, delimiter ...string) map[string]string
- func PrefetchList(proxyURL, bucket string, fileslist []string, wait bool, deadline time.Duration) error
- func PrefetchRange(proxyURL, bucket, prefix, regex, rng string, wait bool, deadline time.Duration) error
- func Progress(id int, period int)
- func PutAsync(wg *sync.WaitGroup, proxyURL, bucket, object string, reader Reader, ...)
- func PutObjsFromList(proxyURL, bucket, readerPath, readerType, objPath string, objSize uint64, ...)
- func PutRandObjs(proxyURL, bucket, readerPath, readerType, objPath string, objSize uint64, ...)
- func RandomObjDir(src *mrand.Rand, dirLen, maxDepth int) (dir string)
- func RegisterTarget(proxyURL string, targetNode *cluster.Snode, smap cluster.Smap) error
- func ReplicateMultipleObjects(proxyURL string, bucketToObjects map[string][]string) map[string]error
- func RestartContainer(cid string) error
- func StartDSort(proxyURL string, rs dsort.RequestSpec) (string, error)
- func StopContainer(cid string) error
- func TargetsInCluster(i int) (ans []string)
- func Tcping(url string) (err error)
- func UnregisterTarget(proxyURL, sid string) error
- func WaitForDSortToFinish(proxyURL, managerUUID string) (bool, error)
- func WaitMapVersionSync(timeout time.Time, smap cluster.Smap, prevVersion int64, idsToIgnore []string) error
- type FileContent
- type HTTPLatencies
- type ParamReader
- type Reader
- func NewBytesReader(buf []byte) Reader
- func NewFileReader(filepath, name string, size int64, withHash bool) (Reader, error)
- func NewFileReaderFromFile(fn string, withHash bool) (Reader, error)
- func NewInMemReader(size int64, withHash bool) (Reader, error)
- func NewRandReader(size int64, withHash bool) (Reader, error)
- func NewReader(p ParamReader) (Reader, error)
- func NewSGReader(sgl *memsys.SGL, size int64, withHash bool) (Reader, error)
- type ReqError
Constants ¶
const ( // ReaderTypeFile defines the name for file reader ReaderTypeFile = "file" // ReaderTypeSG defines the name for sg reader ReaderTypeSG = "sg" // ReaderTypeRand defines the name for rand reader ReaderTypeRand = "rand" // ReaderTypeInMem defines the name for inmem reader ReaderTypeInMem = "inmem" )
Variables ¶
Functions ¶
func AbortDSort ¶
func BaseAPIParams ¶
func BaseAPIParams(url string) *api.BaseParams
func CheckFatal ¶
func ClusterCount ¶
func ClusterCount() int
ClusterCount returns the current number of clusters running
func ConnectContainer ¶
ConnectContainer connects specific containerID to all provided networks.
func ContainerCount ¶
ContainerCount is used by clusterHealthCheck to test if any container crashed after a test completes
func ContainerExec ¶
ContainerExec executes a docker exec command for containerName
func CreateFreshLocalBucket ¶
func CreateTarWithRandomFiles ¶
CreateTarWithRandomFiles creates tar with specified number of files. Tar is also gziped if necessary.
func DefaultBaseAPIParams ¶
func DefaultBaseAPIParams(t *testing.T) *api.BaseParams
func DeleteList ¶
func DeleteRange ¶
func DestroyLocalBucket ¶
func DisconnectContainer ¶
DisconnectContainer diconnects specific containerID from all networks. Returns all networks from which has been disconnected.
func DockerCreateMpathDir ¶
DockerCreateMpathDir creates a directory that will be used as a mountpath for each target in cluster c
func DockerRemoveMpathDir ¶
DockerRemoveMpathDir removes a directory named mpathFQN for each target in cluster c
func DockerRunning ¶
func DockerRunning() bool
DockerRunning returns true if docker-based AIStore cluster is detected
func DoesLocalBucketExist ¶
DoesLocalBucketExist queries a proxy or target to get a list of all local buckets, returns true if the bucket exists.
func EvictRange ¶
func GetFileInfosFromTarBuffer ¶
GetFileInfosFromTarBuffer returns all file infos contained in buffer which assumably is tar or gzipped tar.
func GetFileInfosFromZipBuffer ¶
GetFileInfosFromZipBuffer returns all file infos contained in buffer which assumably is zip.
func GetPrimaryProxy ¶
GetPrimaryProxy returns the primary proxy's url of a cluster
func GetWhatRawQuery ¶
func GetXactionResponse ¶
TODO: rename, and move to the api package
func ListObjects ¶
ListObjects returns a slice of object names of all objects that match the prefix in a bucket
func MetricsDSort ¶
func ParseEnvVariables ¶
ParseEnvVariables takes in a .env file and parses its contents
func PrefetchList ¶
func PrefetchRange ¶
func PutObjsFromList ¶
func PutRandObjs ¶
func RegisterTarget ¶
func ReplicateMultipleObjects ¶
func ReplicateMultipleObjects(proxyURL string, bucketToObjects map[string][]string) map[string]error
ReplicateMultipleObjects replicates all the objects in the map bucketToObjects. bucketsToObjects is a key value pairing where the keys are bucket names and the corresponding value is a slice of objects. ReplicateMultipleObjects returns a map of errors where the key is bucket+"/"+object and the corresponding value is the error that caused replication to fail.
func RestartContainer ¶
RestartContainer restores previously killed target or proxy with given container id
func StartDSort ¶
func StartDSort(proxyURL string, rs dsort.RequestSpec) (string, error)
func StopContainer ¶
StopContainer simulates killing a target or proxy (by given container id)
func TargetsInCluster ¶
TargetsInCluster returns the names of the targets in cluster i
func UnregisterTarget ¶
func WaitForDSortToFinish ¶
Types ¶
type FileContent ¶
func GetFilesFromTarBuffer ¶
func GetFilesFromTarBuffer(buffer bytes.Buffer, extension string) ([]FileContent, error)
GetFilesFromTarBuffer returns all file infos contained in buffer which assumably is tar or gzipped tar.
type HTTPLatencies ¶
type HTTPLatencies struct { ProxyConn time.Duration // from request is created to proxy connection is established Proxy time.Duration // from proxy connection is established to redirected TargetConn time.Duration // from request is redirected to target connection is established Target time.Duration // from target connection is established to request is completed PostHTTP time.Duration // from http ends to after read data from http response and verify hash (if specified) ProxyWroteHeader time.Duration // from ProxyConn to header is written ProxyWroteRequest time.Duration // from ProxyWroteHeader to response body is written ProxyFirstResponse time.Duration // from ProxyWroteRequest to first byte of response TargetWroteHeader time.Duration // from TargetConn to header is written TargetWroteRequest time.Duration // from TargetWroteHeader to response body is written TargetFirstResponse time.Duration // from TargetWroteRequest to first byte of response }
HTTPLatencies stores latency of a http request
func GetConfig ¶
func GetConfig(server string) (HTTPLatencies, error)
GetConfig sends a {what:config} request to the url and discard the message For testing purpose only
func GetWithMetrics ¶
func GetWithMetrics(url, bucket string, keyname string, validate bool, offset, length int64) (int64, HTTPLatencies, error)
Get sends a GET request to url and discards returned data
func PutWithMetrics ¶
func PutWithMetrics(url, bucket, object, hash string, reader cmn.ReadOpenCloser) (HTTPLatencies, error)
Put sends a PUT request to url
type ParamReader ¶
type ParamReader struct { Type string // file | sg | inmem | rand SGL *memsys.SGL // When Type == sg Path, Name string // When Type == file; path and name of file to be created (if not already existing) Size int64 }
ParamReader is used to pass in parameters when creating a new reader
type Reader ¶
type Reader interface { io.ReadCloser io.Seeker Open() (io.ReadCloser, error) XXHash() string Description() string }
Reader is the interface a client works with to read in data and send to a HTTP server
func NewBytesReader ¶
NewBytesReader returns a new bytesReader
func NewFileReader ¶
NewFileReader creates/opens the file, populates it with random data, closes it and returns a new fileReader
func NewFileReaderFromFile ¶
NewFileReaderFromFile opens an existing file, reads it to compute checksum, closes it, and returns a new reader. See also (and note the difference from): NewFileReader
func NewInMemReader ¶
NewInMemReader returns a new inMemReader
func NewRandReader ¶
NewRandReader returns a new randReader
func NewReader ¶
func NewReader(p ParamReader) (Reader, error)
NewReader returns a data reader; type of reader returned is based on the parameters provided