testutil

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultTestDB = "db"
)

Variables

This section is empty.

Functions

func AppendClosure

func AppendClosure(t *testing.T, data *containers.Batch, name string, e *db.DB, wg *sync.WaitGroup) func()

func AppendFailClosure

func AppendFailClosure(t *testing.T, data *containers.Batch, name string, e *db.DB, wg *sync.WaitGroup) func()

func CheckAllColRowsByScan

func CheckAllColRowsByScan(t *testing.T, rel handle.Relation, expectRows int, applyDelete bool)

func CheckCheckpointReadWrite

func CheckCheckpointReadWrite(
	t *testing.T,
	start, end types.TS,
	c *catalog.Catalog,
	checkpointBlockRows int,
	checkpointSize int,
	fs fileservice.FileService,
)

func CompactBlocks

func CompactBlocks(t *testing.T, tenantID uint32, e *db.DB, dbName string, schema *catalog.Schema, skipConflict bool)

func CreateDB

func CreateDB(t *testing.T, e *db.DB, dbName string)

func CreateRelation

func CreateRelation(t *testing.T, e *db.DB, dbName string, schema *catalog.Schema, createDB bool) (db handle.Database, rel handle.Relation)

func CreateRelationAndAppend

func CreateRelationAndAppend(
	t *testing.T,
	tenantID uint32,
	e *db.DB,
	dbName string,
	schema *catalog.Schema,
	bat *containers.Batch,
	createDB bool) (db handle.Database, rel handle.Relation)

func CreateRelationNoCommit

func CreateRelationNoCommit(t *testing.T, e *db.DB, dbName string, schema *catalog.Schema, createDB bool) (txn txnif.AsyncTxn, db handle.Database, rel handle.Relation)

func DropDB

func DropDB(t *testing.T, e *db.DB, dbName string)

func ForEachBlock

func ForEachBlock(rel handle.Relation, fn func(blk handle.Block) error)

func ForEachColumnView

func ForEachColumnView(rel handle.Relation, colIdx int, fn func(view *containers.ColumnView) error)

func ForEachSegment

func ForEachSegment(rel handle.Relation, fn func(seg handle.Segment) error)

func GetAllBlockMetas

func GetAllBlockMetas(rel handle.Relation) (metas []*catalog.BlockEntry)

func GetColumnRowsByScan

func GetColumnRowsByScan(t *testing.T, rel handle.Relation, colIdx int, applyDelete bool) int

func GetDefaultRelation

func GetDefaultRelation(t *testing.T, e *db.DB, name string) (txn txnif.AsyncTxn, rel handle.Relation)

func GetOneBlock

func GetOneBlock(rel handle.Relation) handle.Block

func GetOneBlockMeta

func GetOneBlockMeta(rel handle.Relation) *catalog.BlockEntry

func GetRelation

func GetRelation(t *testing.T, tenantID uint32, e *db.DB, dbName, tblName string) (txn txnif.AsyncTxn, rel handle.Relation)

func GetRelationWithTxn

func GetRelationWithTxn(t *testing.T, txn txnif.AsyncTxn, dbName, tblName string) (rel handle.Relation)

func GetSingleSortKeyValue

func GetSingleSortKeyValue(bat *containers.Batch, schema *catalog.Schema, row int) (v any)

func InitTestDB

func InitTestDB(
	ctx context.Context,
	moduleName string,
	t *testing.T,
	opts *options.Options,
) *db.DB

func InitTestDBWithDir

func InitTestDBWithDir(
	ctx context.Context,
	dir string,
	t *testing.T,
	opts *options.Options,
) *db.DB

func LenOfBats

func LenOfBats(bats []*containers.Batch) int

func MergeBlocks

func MergeBlocks(t *testing.T, tenantID uint32, e *db.DB, dbName string, schema *catalog.Schema, skipConflict bool)

func MockCNDeleteInS3

func MockCNDeleteInS3(
	fs *objectio.ObjectFS,
	blk data.Block,
	schema *catalog.Schema,
	txn txnif.AsyncTxn,
	deleteRows []uint32,
) (location objectio.Location, err error)

func PrintCheckpointStats

func PrintCheckpointStats(t *testing.T, tae *db.DB)

func WithTestAllPKType

func WithTestAllPKType(t *testing.T, tae *db.DB, test func(*testing.T, *db.DB, *catalog.Schema))

Types

type CtxOldVersion

type CtxOldVersion struct{}

type TestEngine

type TestEngine struct {
	*db.DB
	// contains filtered or unexported fields
}

func NewTestEngine

func NewTestEngine(
	ctx context.Context,
	moduleName string,
	t *testing.T,
	opts *options.Options,
) *TestEngine

func NewTestEngineWithDir

func NewTestEngineWithDir(
	ctx context.Context,
	dir string,
	t *testing.T,
	opts *options.Options,
) *TestEngine

func (*TestEngine) BindSchema

func (e *TestEngine) BindSchema(schema *catalog.Schema)

func (*TestEngine) BindTenantID

func (e *TestEngine) BindTenantID(tenantID uint32)

func (*TestEngine) CheckCollectDeleteInRange

func (e *TestEngine) CheckCollectDeleteInRange()

func (*TestEngine) CheckReadCNCheckpoint

func (e *TestEngine) CheckReadCNCheckpoint()

func (*TestEngine) CheckRowsByScan

func (e *TestEngine) CheckRowsByScan(exp int, applyDelete bool)

func (*TestEngine) Close

func (e *TestEngine) Close() error

func (*TestEngine) CompactBlocks

func (e *TestEngine) CompactBlocks(skipConflict bool)

func (*TestEngine) CreateRelAndAppend

func (e *TestEngine) CreateRelAndAppend(bat *containers.Batch, createDB bool) (handle.Database, handle.Relation)

func (*TestEngine) DeleteAll

func (e *TestEngine) DeleteAll(skipConflict bool) error

func (*TestEngine) DoAppend

func (e *TestEngine) DoAppend(bat *containers.Batch)

func (*TestEngine) DoAppendWithTxn

func (e *TestEngine) DoAppendWithTxn(bat *containers.Batch, txn txnif.AsyncTxn, skipConflict bool) (err error)

func (*TestEngine) DropRelation

func (e *TestEngine) DropRelation(t *testing.T)

func (*TestEngine) ForceCheckpoint

func (e *TestEngine) ForceCheckpoint()

func (*TestEngine) ForceLongCheckpoint

func (e *TestEngine) ForceLongCheckpoint()

func (*TestEngine) GetDB

func (e *TestEngine) GetDB(name string) (txn txnif.AsyncTxn, db handle.Database)

func (*TestEngine) GetRelation

func (e *TestEngine) GetRelation() (txn txnif.AsyncTxn, rel handle.Relation)

func (*TestEngine) GetRelationWithTxn

func (e *TestEngine) GetRelationWithTxn(txn txnif.AsyncTxn) (rel handle.Relation)

func (*TestEngine) GetTestDB

func (e *TestEngine) GetTestDB() (txn txnif.AsyncTxn, db handle.Database)

func (*TestEngine) GlobalCheckpoint

func (e *TestEngine) GlobalCheckpoint(
	endTs types.TS,
	versionInterval time.Duration,
	enableAndCleanBGCheckpoint bool,
) error

func (*TestEngine) IncrementalCheckpoint

func (e *TestEngine) IncrementalCheckpoint(
	end types.TS,
	enableAndCleanBGCheckpoint bool,
	waitFlush bool,
	truncate bool,
) error

func (*TestEngine) MergeBlocks

func (e *TestEngine) MergeBlocks(skipConflict bool)

func (*TestEngine) Restart

func (e *TestEngine) Restart(ctx context.Context)

func (*TestEngine) Truncate

func (e *TestEngine) Truncate()

func (*TestEngine) TryAppend

func (e *TestEngine) TryAppend(bat *containers.Batch)

func (*TestEngine) TryDeleteByDeltaloc

func (e *TestEngine) TryDeleteByDeltaloc(vals []any) (ok bool, err error)

func (*TestEngine) TryDeleteByDeltalocWithTxn

func (e *TestEngine) TryDeleteByDeltalocWithTxn(vals []any, txn txnif.AsyncTxn) (ok bool, err error)

Jump to

Keyboard shortcuts

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