testutil

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTestDB = "db"
)

Variables

This section is empty.

Functions

func AllCheckpointsFinished

func AllCheckpointsFinished(e *db.DB) bool

func Append

func Append(t *testing.T, accountID uint32, db *db.DB, dbName, tableName string, bat *containers.Batch)

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,
	end types.TS,
	c *catalog.Catalog,
	checkpointSize int,
	e *TestEngine,
)

TODO: use ctx

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 CreateDatabase2

func CreateDatabase2(ctx context.Context, txn txnif.AsyncTxn, dbName string) (handle.Database, error)

func CreateDatabase2Ext

func CreateDatabase2Ext(ctx context.Context, txn txnif.AsyncTxn, dbName, createsql, dattype string) (handle.Database, error)

func CreateOneDatabase

func CreateOneDatabase(
	ctx context.Context,
	t *testing.T,
	tae *db.DB,
	i int,
) (name 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 CreateRelation2

func CreateRelation2(ctx context.Context, txn txnif.AsyncTxn, db handle.Database, schema *catalog.Schema) (handle.Relation, error)

func CreateRelationAndAppend

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

func CreateRelationAndAppend2

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

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 DeleteAll

func DeleteAll(t *testing.T, accountID uint32, db *db.DB, dbName, tableName string)

func DropDB

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

func DropDatabase2

func DropDatabase2(ctx context.Context, txn txnif.AsyncTxn, dbName string) error

func DropRelation2

func DropRelation2(ctx context.Context, txn txnif.AsyncTxn, db handle.Database, tblName string) error

func ForEachColumnView

func ForEachColumnView(t *testing.T, rel handle.Relation, colIdx int, fn func(view *containers.Batch) error)

func ForEachObject added in v1.1.0

func ForEachObject(t *testing.T, rel handle.Relation, fn func(obj handle.Object) error)

func ForEachTombstone

func ForEachTombstone(t *testing.T, rel handle.Relation, fn func(obj handle.Object) error)

func GetAllAppendableMetas

func GetAllAppendableMetas(rel handle.Relation, isTombstone bool) (metas []*catalog.ObjectEntry)

func GetAllBlockMetas

func GetAllBlockMetas(rel handle.Relation, isTombstone bool) (metas []*catalog.ObjectEntry)

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 GetOneBlockMeta

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

GetOneBlockMeta returns the oldest visible object's meta in the relation

func GetOneObject added in v1.2.0

func GetOneObject(rel handle.Relation) handle.Object

GetOneObject returns the newest visible object in the relation

func GetOneTombstoneMeta

func GetOneTombstoneMeta(rel handle.Relation) *catalog.ObjectEntry

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,
	dbOpts ...db.DBOption,
) *db.DB

func InitTestDBWithDir

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

func IsCatalogEqual

func IsCatalogEqual(t *testing.T, c1, c2 *catalog.Catalog)

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 fileservice.FileService,
	rowIDVec containers.Vector,
	pkVec containers.Vector,
	schema *catalog.Schema,
	txn txnif.AsyncTxn,
) (stats objectio.ObjectStats, err error)

func MockObjectStats

func MockObjectStats(t *testing.T, obj handle.Object)

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
	T *testing.T
	// contains filtered or unexported fields
}

func NewReplayTestEngine

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

func NewTestEngine

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

func NewTestEngineWithDir

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

func (*TestEngine) AllCheckpointsFinished

func (e *TestEngine) AllCheckpointsFinished() bool

func (*TestEngine) AllFlushExpected

func (e *TestEngine) AllFlushExpected(ts types.TS, timeoutMS int)

func (*TestEngine) BindSchema

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

func (*TestEngine) BindTenantID

func (e *TestEngine) BindTenantID(tenantID uint32)

func (*TestEngine) CheckCollectTombstoneInRange

func (e *TestEngine) CheckCollectTombstoneInRange()

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)

func (*TestEngine) CreateRelAndAppend2

func (e *TestEngine) CreateRelAndAppend2(bat *containers.Batch, createDB bool)

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) ForceLongCheckpointTruncate

func (e *TestEngine) ForceLongCheckpointTruncate()

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) MergeBlocks

func (e *TestEngine) MergeBlocks(skipConflict bool)

func (*TestEngine) Restart

func (e *TestEngine) Restart(ctx context.Context, opts ...*options.Options)

func (*TestEngine) RestartDisableGC added in v1.2.0

func (e *TestEngine) RestartDisableGC(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