testtools

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: Apache-2.0 Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertReaderIsEmpty

func AssertReaderIsEmpty(t *testing.T, reader io.Reader)

func Contains

func Contains(s *[]string, e string) bool

func CreateTar

func CreateTar(w io.Writer, r *io.LimitedReader)

CreateTar creates a new tarball from the passed in reader and writes to a destination writer.

func MakeDefaultUploader added in v0.2.1

func MakeDefaultUploader(uploaderAPI s3manageriface.UploaderAPI) *internal.S3Uploader

func NewLz4CompressingPipeWriter

func NewLz4CompressingPipeWriter(input io.Reader) *internal.CompressingPipeWriter

func NewMockS3Client

func NewMockS3Client(err, notFound bool) *mockS3Client

func NewMockS3Uploader

func NewMockS3Uploader(multiErr, err bool, storage *InMemoryStorage) *mockS3Uploader

func NewMockUploader

func NewMockUploader(apiMultiErr, apiErr bool) *internal.Uploader

func NewStoringMockUploader

func NewStoringMockUploader(storage *InMemoryStorage, deltaDataFolder internal.DataFolder) *internal.Uploader

Types

type BufferTarBall

type BufferTarBall struct {
	// contains filtered or unexported fields
}

BufferTarBall represents a tarball that is written to buffer.

func (*BufferTarBall) AddSize

func (tarBall *BufferTarBall) AddSize(add int64)

func (*BufferTarBall) AwaitUploads

func (tarBall *BufferTarBall) AwaitUploads()

func (*BufferTarBall) CloseTar

func (tarBall *BufferTarBall) CloseTar() error

func (*BufferTarBall) Finish

func (tarBall *BufferTarBall) Finish(sentinelDto *internal.BackupSentinelDto) error

func (*BufferTarBall) SetUp

func (tarBall *BufferTarBall) SetUp(crypter internal.Crypter, args ...string)

func (*BufferTarBall) Size

func (tarBall *BufferTarBall) Size() int64

func (*BufferTarBall) TarWriter

func (tarBall *BufferTarBall) TarWriter() *tar.Writer

type BufferTarBallMaker

type BufferTarBallMaker struct {
	BufferToWrite *bytes.Buffer
	// contains filtered or unexported fields
}

func (*BufferTarBallMaker) Make

func (tarBallMaker *BufferTarBallMaker) Make(dedicatedUploader bool) internal.TarBall

type BufferTarInterpreter

type BufferTarInterpreter struct {
	Out []byte
}

BufferTarInterpreter extracts data to a byte slice. Used for testing purposes.

func (*BufferTarInterpreter) Interpret

func (tarInterpreter *BufferTarInterpreter) Interpret(reader io.Reader, header *tar.Header) error

Interpret handles in memory tar formats. Used for testing purposes.

type FileReaderMaker

type FileReaderMaker struct {
	Key string
}

FileReaderMaker decompresses lzop tarballs from the passed in file.

func (*FileReaderMaker) Path

func (f *FileReaderMaker) Path() string

func (*FileReaderMaker) Reader

func (f *FileReaderMaker) Reader() (io.ReadCloser, error)

Reader creates a new reader from the passed in file.

type FileTarBall

type FileTarBall struct {
	// contains filtered or unexported fields
}

FileTarBall represents a tarball that is written to disk.

func (*FileTarBall) AddSize

func (tarBall *FileTarBall) AddSize(i int64)

func (*FileTarBall) AwaitUploads

func (tarBall *FileTarBall) AwaitUploads()

func (*FileTarBall) CloseTar

func (tarBall *FileTarBall) CloseTar() error

CloseTar closes the tar writer and file, flushing any unwritten data to the file before closing.

func (*FileTarBall) Finish

func (tarBall *FileTarBall) Finish(sentinelDto *internal.BackupSentinelDto) error

Finish alerts that compression is complete.

func (*FileTarBall) SetUp

func (tarBall *FileTarBall) SetUp(crypter internal.Crypter, names ...string)

SetUp creates a new LZ4 writer, tar writer and file for writing bundled compressed bytes to.

func (*FileTarBall) Size

func (tarBall *FileTarBall) Size() int64

func (*FileTarBall) TarWriter

func (tarBall *FileTarBall) TarWriter() *tar.Writer

type FileTarBallMaker

type FileTarBallMaker struct {
	Out string
	// contains filtered or unexported fields
}

FileTarBallMaker creates a new FileTarBall with the directory that files should be extracted to.

func (*FileTarBallMaker) Make

func (tarBallMaker *FileTarBallMaker) Make(inheritState bool) internal.TarBall

Make creates a new FileTarBall.

type HTTPReaderMaker

type HTTPReaderMaker struct {
	Client *http.Client
	Key    string
}

HTTPReaderMaker decompresses lzop tarballs from the passed in url.

func (*HTTPReaderMaker) Path

func (h *HTTPReaderMaker) Path() string

func (*HTTPReaderMaker) Reader

func (h *HTTPReaderMaker) Reader() (io.ReadCloser, error)

Reader creates a new request to grab the data generated by the random bytes generator.

type InMemoryStorage added in v0.2.1

type InMemoryStorage struct {
	// contains filtered or unexported fields
}

func NewInMemoryStorage added in v0.2.1

func NewInMemoryStorage() *InMemoryStorage

func (*InMemoryStorage) Load added in v0.2.1

func (storage *InMemoryStorage) Load(key string) (value TimeStampedData, exists bool)

func (*InMemoryStorage) Range added in v0.2.1

func (storage *InMemoryStorage) Range(callback func(key string, value TimeStampedData) bool)

func (*InMemoryStorage) Store added in v0.2.1

func (storage *InMemoryStorage) Store(key string, value bytes.Buffer)

type InMemoryStorageFolder added in v0.2.1

type InMemoryStorageFolder struct {
	Storage *InMemoryStorage
	// contains filtered or unexported fields
}

func MakeDefaultInMemoryStorageFolder added in v0.2.1

func MakeDefaultInMemoryStorageFolder() *InMemoryStorageFolder

func NewInMemoryStorageFolder added in v0.2.1

func NewInMemoryStorageFolder(path string, storage *InMemoryStorage) *InMemoryStorageFolder

func (*InMemoryStorageFolder) DeleteObjects added in v0.2.1

func (folder *InMemoryStorageFolder) DeleteObjects(objectRelativePaths []string) error

func (*InMemoryStorageFolder) Exists added in v0.2.1

func (folder *InMemoryStorageFolder) Exists(objectRelativePath string) (bool, error)

func (*InMemoryStorageFolder) GetPath added in v0.2.1

func (folder *InMemoryStorageFolder) GetPath() string

func (*InMemoryStorageFolder) GetSubFolder added in v0.2.1

func (folder *InMemoryStorageFolder) GetSubFolder(subFolderRelativePath string) internal.StorageFolder

func (*InMemoryStorageFolder) ListFolder added in v0.2.1

func (folder *InMemoryStorageFolder) ListFolder() (objects []internal.StorageObject, subFolders []internal.StorageFolder, err error)

func (*InMemoryStorageFolder) PutObject added in v0.2.1

func (folder *InMemoryStorageFolder) PutObject(name string, content io.Reader) error

func (*InMemoryStorageFolder) ReadObject added in v0.2.1

func (folder *InMemoryStorageFolder) ReadObject(objectRelativePath string) (io.ReadCloser, error)

type InMemoryStorageObject added in v0.2.1

type InMemoryStorageObject struct {
	// contains filtered or unexported fields
}

func NewInMemoryStorageObject added in v0.2.1

func NewInMemoryStorageObject(absPath string, lastModified time.Time) *InMemoryStorageObject

func (*InMemoryStorageObject) GetLastModified added in v0.2.1

func (object *InMemoryStorageObject) GetLastModified() time.Time

func (*InMemoryStorageObject) GetName added in v0.2.1

func (object *InMemoryStorageObject) GetName() string

type MockCompressingWriter

type MockCompressingWriter struct {
	io.Writer
}

func (*MockCompressingWriter) Close

func (writer *MockCompressingWriter) Close() error

func (*MockCompressingWriter) ReadFrom

func (writer *MockCompressingWriter) ReadFrom(reader io.Reader) (n int64, err error)

type MockCompressor

type MockCompressor struct{}

func (*MockCompressor) FileExtension

func (compressor *MockCompressor) FileExtension() string

func (*MockCompressor) NewWriter

func (compressor *MockCompressor) NewWriter(writer io.Writer) internal.ReaderFromWriteCloser

type MockDataFolder

type MockDataFolder map[string]*bytes.Buffer

func NewMockDataFolder

func NewMockDataFolder() *MockDataFolder

func (*MockDataFolder) CleanFolder

func (folder *MockDataFolder) CleanFolder() error

func (*MockDataFolder) IsEmpty

func (folder *MockDataFolder) IsEmpty() bool

func (*MockDataFolder) OpenReadonlyFile

func (folder *MockDataFolder) OpenReadonlyFile(filename string) (io.ReadCloser, error)

func (*MockDataFolder) OpenWriteOnlyFile

func (folder *MockDataFolder) OpenWriteOnlyFile(filename string) (io.WriteCloser, error)

type MockReadWriteCloser

type MockReadWriteCloser struct{}

func (*MockReadWriteCloser) Close

func (readWriterCloser *MockReadWriteCloser) Close() error

func (*MockReadWriteCloser) Read

func (readWriterCloser *MockReadWriteCloser) Read(p []byte) (n int, err error)

func (*MockReadWriteCloser) Write

func (readWriterCloser *MockReadWriteCloser) Write(p []byte) (n int, err error)

type NOPTarInterpreter

type NOPTarInterpreter struct{}

NOPTarInterpreter mocks a tar extractor.

func (*NOPTarInterpreter) Interpret

func (tarInterpreter *NOPTarInterpreter) Interpret(tr io.Reader, header *tar.Header) error

Interpret does not do anything except print the 'tar member' name.

type NopCloser

type NopCloser struct{}

func (*NopCloser) Close

func (closer *NopCloser) Close() error

type NopSeeker

type NopSeeker struct{}

func (*NopSeeker) Seek

func (seeker *NopSeeker) Seek(offset int64, whence int) (int64, error)

type ReadWriteNopCloser

type ReadWriteNopCloser struct {
	io.ReadWriter
}

func (*ReadWriteNopCloser) Close

func (readWriteNopCloser *ReadWriteNopCloser) Close() error

type StrideByteReader

type StrideByteReader struct {
	// contains filtered or unexported fields
}

StrideByteReader allows for customizable "strides" of random bytes. Creates an infinite stream.

func NewStrideByteReader

func NewStrideByteReader(s int) *StrideByteReader

NewStrideByteReader creates a new random byte stride generator with a seed of 0.

func (*StrideByteReader) Read

func (sb *StrideByteReader) Read(p []byte) (int, error)

Read creates randomly generated bytes of 'stride' length.

type TimeStampedData added in v0.2.1

type TimeStampedData struct {
	Data      bytes.Buffer
	Timestamp time.Time
}

func TimeStampData added in v0.2.1

func TimeStampData(data bytes.Buffer) TimeStampedData

Jump to

Keyboard shortcuts

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