testutil

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() (appDB *storage.BadgerStore, stateTreeDB tmdb.DB)

GetDB test databases

func RandomAddr

func RandomAddr() string

func ReturnStringOnCallCount

func ReturnStringOnCallCount(callCount *int, ret ...string) string

ReturnStringOnCallCount returns the element in ret that correspond with the callCount value. Use this in repeatedly called callback functions when you want to determine what value to return at a given call count.

func SetTestCfg

func SetTestCfg(opts ...string) (cfg *config.AppConfig, err error)

SetTestCfg prepare a config directory for tests

Types

type FileReader

type FileReader interface {
	io.Reader
	io.Closer
	Fd() uintptr
}

FileReader provides a minimal interface for Stdout.

type FileWriter

type FileWriter interface {
	io.Writer
	Fd() uintptr
}

FileWriter provides a minimal interface for Stdin.

type MockObjects

type MockObjects struct {
	Logic              *mocks.MockLogic
	AtomicLogic        *mocks.MockAtomicLogic
	Validator          *mocks.MockValidatorLogic
	SysKeeper          *mocks.MockSystemKeeper
	AccountKeeper      *mocks.MockAccountKeeper
	ValidatorKeeper    *mocks.MockValidatorKeeper
	RepoKeeper         *mocks.MockRepoKeeper
	TicketManager      *mocks.MockTicketManager
	RepoSyncInfoKeeper *mocks.MockRepoSyncInfoKeeper
	StateTree          *mocks.MockTree
	RemoteServer       *mocks.MockRemoteServer
	PushKeyKeeper      *mocks.MockPushKeyKeeper
	NamespaceKeeper    *mocks.MockNamespaceKeeper
	BlockGetter        *mocks.MockBlockGetter
	DHTKeeper          *mocks.MockDHTKeeper
	Service            *mocks.MockService
}

MockObjects contains mocks for various structs

func Mocks

func Mocks(ctrl *gomock.Controller) *MockObjects

Mocks returns logic package mocks

type ReadCloser

type ReadCloser interface {
	Read(p []byte) (n int, err error)
	Close() error
}

type Reader

type Reader struct {
	Data []byte
	Err  error
}

func (Reader) Read

func (r Reader) Read(p []byte) (n int, err error)

type WrapReadCloser

type WrapReadCloser struct {
	Buf []byte
	Err error
}

WrapReadCloser implements ReadCloser

func (WrapReadCloser) Close

func (w WrapReadCloser) Close() error

func (WrapReadCloser) Read

func (w WrapReadCloser) Read(p []byte) (n int, err error)

type WrapReadSeeker

type WrapReadSeeker struct {
	Rdr io.Reader
}

func (WrapReadSeeker) Read

func (w WrapReadSeeker) Read(p []byte) (n int, err error)

func (WrapReadSeeker) Seek

func (w WrapReadSeeker) Seek(offset int64, whence int) (int64, error)

type WrapReadSeekerCloser

type WrapReadSeekerCloser struct {
	Rdr      io.Reader
	CloseErr error
}

func (WrapReadSeekerCloser) Close

func (w WrapReadSeekerCloser) Close() error

func (WrapReadSeekerCloser) Read

func (w WrapReadSeekerCloser) Read(p []byte) (n int, err error)

func (WrapReadSeekerCloser) Seek

func (w WrapReadSeekerCloser) Seek(offset int64, whence int) (int64, error)

Jump to

Keyboard shortcuts

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