testutil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBytes

func AppendBytes(chunks ...[]byte) []byte

func Entry

func Entry(now uint32, key, val []byte) []byte

func U32ToB

func U32ToB(i uint32) []byte

Types

type FS

type FS struct {
	*mocks2.FS

	Path     string
	DataFile string
	// contains filtered or unexported fields
}

FS is a mock FS

func NewFS

func NewFS() *FS

NewFS creates new mock FS

func (*FS) AddMockDataFileEntry

func (fs *FS) AddMockDataFileEntry(fName string, entry []byte)

AddMockDataFileEntry adds entry to a mock data file

func (*FS) UseMockDataFiles

func (fs *FS) UseMockDataFiles() *FS

UseMockDataFiles uses mocked in memory files (set by AddMockDataFileEntry)

func (*FS) VerifyDataFileIsRotated

func (fs *FS) VerifyDataFileIsRotated(t *testing.T)

VerifyDataFileIsRotated verifies that current active data file has been closed and that new one has been opened

func (*FS) VerifyEntryWritten

func (fs *FS) VerifyEntryWritten(t *testing.T, entry []byte)

VerifyEntryWritten verifies that entry was bytesWritten

func (*FS) VerifyWriteGoesToNewlyActiveDataFile

func (fs *FS) VerifyWriteGoesToNewlyActiveDataFile(t *testing.T)

func (*FS) WithFailOnReadValueFromFile

func (fs *FS) WithFailOnReadValueFromFile(err error) *FS

func (*FS) WithFailWithErrOnWrite

func (fs *FS) WithFailWithErrOnWrite(err error) *FS

WithFailWithErrOnWrite setup

func (*FS) WithMockValue

func (fs *FS) WithMockValue(val []byte) *FS

WithMockValue setup

func (*FS) WithMockWriteSupport

func (fs *FS) WithMockWriteSupport() *FS

WithMockWriteSupport setup

func (*FS) WithToppedUpDataFile

func (fs *FS) WithToppedUpDataFile(atSize int64) *FS

WithToppedUpDataFile setup

type InMemory

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

func NewInMemory

func NewInMemory(fs cask.FS) *InMemory

func (*InMemory) Open

func (i *InMemory) Open(path string) (cask.File, error)

func (*InMemory) ReadFileAt

func (i *InMemory) ReadFileAt(path string, file string, b []byte, offset int64) (int, error)

func (*InMemory) Rotate

func (i *InMemory) Rotate(path string) (cask.File, error)

func (*InMemory) Walk

func (i *InMemory) Walk(path string, f func(cask.File) error) error

func (*InMemory) WithPartialWriteFor

func (i *InMemory) WithPartialWriteFor(key []byte) *InMemory

type InMemoryFile

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

func (*InMemoryFile) Close

func (i *InMemoryFile) Close() error

func (*InMemoryFile) Name

func (i *InMemoryFile) Name() string

func (*InMemoryFile) Read

func (i *InMemoryFile) Read(p []byte) (n int, err error)

func (*InMemoryFile) Size

func (i *InMemoryFile) Size() int64

func (*InMemoryFile) Write

func (i *InMemoryFile) Write(p []byte) (int, error)

type Time

type Time uint32

func (Time) NowUnix

func (t Time) NowUnix() uint32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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