testtools

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SimplePath      = "/simple"
	SkippedPath     = "/skipped"
	IncrementedPath = "/incremented"
)

Variables

View Source
var IncrementedDescription = *internal.NewBackupFileDescription(true, false, time.Time{})
View Source
var MockCloseError = errors.New("mock close: close error")
View Source
var MockReadError = errors.New("mock reader: read error")
View Source
var MockWriteError = errors.New("mock writer: write error")

Functions

func AssertReaderIsEmpty

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

func Contains

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

func CreateMockStorageFolder added in v0.2.10

func CreateMockStorageFolder() storage.Folder

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 CreateWalPageWithContinuation added in v0.2.10

func CreateWalPageWithContinuation() []byte

func GetXLogRecordData added in v0.2.10

func GetXLogRecordData() (walparser.XLogRecord, []byte)

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 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 BackupFileListBuilder added in v0.2.10

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

func NewBackupFileListBuilder added in v0.2.10

func NewBackupFileListBuilder() BackupFileListBuilder

func (BackupFileListBuilder) Build added in v0.2.10

func (listBuilder BackupFileListBuilder) Build() internal.BackupFileList

func (BackupFileListBuilder) WithIncremented added in v0.2.10

func (listBuilder BackupFileListBuilder) WithIncremented() BackupFileListBuilder

func (BackupFileListBuilder) WithSimple added in v0.2.10

func (listBuilder BackupFileListBuilder) WithSimple() BackupFileListBuilder

func (BackupFileListBuilder) WithSkipped added in v0.2.10

func (listBuilder BackupFileListBuilder) WithSkipped() BackupFileListBuilder

type BufCloser added in v0.2.10

type BufCloser struct {
	*bytes.Buffer
	Err bool
}

func (*BufCloser) Close added in v0.2.10

func (w *BufCloser) Close() error

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 crypto.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 ErrorReader added in v0.2.10

type ErrorReader struct{}

ErrorReader struct implements io.Reader interface. Its Read method returns zero and non-nil error on every call

func (ErrorReader) Read added in v0.2.10

func (r ErrorReader) Read(b []byte) (int, error)

type ErrorWriteCloser added in v0.2.10

type ErrorWriteCloser struct{}

func (ErrorWriteCloser) Close added in v0.2.10

func (ew ErrorWriteCloser) Close() error

func (ErrorWriteCloser) Write added in v0.2.10

func (ew ErrorWriteCloser) Write(p []byte) (int, error)

type ErrorWriter added in v0.2.10

type ErrorWriter struct{}

ErrorWriter struct implements io.Writer interface. Its Write method returns zero and non-nil error on every call

func (ErrorWriter) Write added in v0.2.10

func (w ErrorWriter) Write(b []byte) (int, error)

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 crypto.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 MockCompressor

type MockCompressor struct{}

func (*MockCompressor) FileExtension

func (compressor *MockCompressor) FileExtension() string

func (*MockCompressor) NewWriter

func (compressor *MockCompressor) NewWriter(writer io.Writer) io.WriteCloser

type MockDataFolder

type MockDataFolder map[string]*bytes.Buffer

func NewMockDataFolder

func NewMockDataFolder() *MockDataFolder

func (*MockDataFolder) CleanFolder

func (folder *MockDataFolder) CleanFolder() error

func (*MockDataFolder) CreateFile added in v0.2.10

func (folder *MockDataFolder) CreateFile(filename string) error

func (*MockDataFolder) DeleteFile added in v0.2.10

func (folder *MockDataFolder) DeleteFile(filename string) error

func (*MockDataFolder) FileExists added in v0.2.10

func (folder *MockDataFolder) FileExists(filename string) bool

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 NopCloserWriter added in v0.2.10

type NopCloserWriter struct {
	io.Writer
}

func (NopCloserWriter) Close added in v0.2.10

func (NopCloserWriter) 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