testtools

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

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 MakeDefaultInMemoryStorageFolder added in v0.2.1

func MakeDefaultInMemoryStorageFolder() *memory.Folder

func MakeDefaultUploader added in v0.2.1

func MakeDefaultUploader(uploaderAPI s3manageriface.UploaderAPI) *s3.Uploader

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 *memory.Storage) *mockS3Uploader

func NewMockUploader

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

func NewStoringMockUploader

func NewStoringMockUploader(storage *memory.Storage, 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) 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) 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 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.

Jump to

Keyboard shortcuts

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