testutils

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpdateExpectedFlag = flag.Bool("update-expected", false, "make test to update expected results")
)

Functions

func AppendIfNotEmpty

func AppendIfNotEmpty(slice []string, val string) []string

func GetErrorMsgIfDifferent

func GetErrorMsgIfDifferent(expected, received, errMsg string) string

func GetTableCaseNameFromCaseName

func GetTableCaseNameFromCaseName(caseName string) string

func GetTableFromName

func GetTableFromName(t testInterface, testCaseName string) *typedef.Table

Types

type ExpectedEntry

type ExpectedEntry[T any] interface {
	Equal(T) bool
	Diff(T) string
}

type ExpectedStore

type ExpectedStore[T ExpectedEntry[T]] struct {
	// contains filtered or unexported fields
}

func LoadExpectedFromFile

func LoadExpectedFromFile[T ExpectedEntry[T]](t *testing.T, filePath string, cases []string, updateExpected bool) *ExpectedStore[T]

func (*ExpectedStore[T]) CompareOrStore

func (f *ExpectedStore[T]) CompareOrStore(t *testing.T, caseName string, received T)

func (*ExpectedStore[T]) UpdateExpected

func (f *ExpectedStore[T]) UpdateExpected(t *testing.T)

type FuncOptions

type FuncOptions struct {
	AddType  typedef.ColumnDef
	IdxCount int
	UseLWT   bool
	PkCount  int
	CkCount  int
	DelNum   int
}

type MockGenerator

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

func GetAllForTestStmt

func GetAllForTestStmt(t testInterface, testCaseName string) (*typedef.Schema, *MockGenerator, *rand.Rand)

func NewTestGenerator

func NewTestGenerator(
	table *typedef.Table,
	rnd *rand.Rand,
	partitionsConfig *typedef.PartitionRangeConfig,
	routingKeyCreator *routingkey.Creator,
) *MockGenerator

func (*MockGenerator) Get

func (*MockGenerator) GetOld

func (g *MockGenerator) GetOld() *typedef.ValueWithToken

func (*MockGenerator) GiveOld

func (g *MockGenerator) GiveOld(_ *typedef.ValueWithToken)

func (*MockGenerator) GiveOlds added in v1.8.7

func (g *MockGenerator) GiveOlds(_ []*typedef.ValueWithToken)

func (*MockGenerator) ReleaseToken

func (g *MockGenerator) ReleaseToken(_ uint64)

type NonRandSource

type NonRandSource uint64

func (NonRandSource) Seed

func (s NonRandSource) Seed(uint64)

func (NonRandSource) Uint64

func (s NonRandSource) Uint64() uint64

type TestCaseOptions

type TestCaseOptions []string

func GetOptionsFromCaseName

func GetOptionsFromCaseName(caseName string) TestCaseOptions

func SplitCaseName

func SplitCaseName(caseName string) (string, TestCaseOptions)

func (TestCaseOptions) GetBool

func (o TestCaseOptions) GetBool(name string) bool

func (TestCaseOptions) GetString

func (o TestCaseOptions) GetString(name string) string

func (TestCaseOptions) HandleOption

func (o TestCaseOptions) HandleOption(name string, handler func(option string))

Jump to

Keyboard shortcuts

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