testutil

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRecordsToBatch

func AddRecordsToBatch(batch index.WriteBatch, tableName string, start, numRecords int)

func AddRecordsToDB

func AddRecordsToDB(t testing.TB, path string, dbClient *local.BoltIndexClient, start, numRecords int, bucketName []byte)

func BuildUserID

func BuildUserID(id int) string

func CompareDBs

func CompareDBs(t *testing.T, db1, db2 *bbolt.DB)

func DecompressFile

func DecompressFile(t *testing.T, src, dest string)

func SetupDBsAtPath

func SetupDBsAtPath(t *testing.T, path string, dbs map[string]DBConfig, bucketName []byte) string

func SetupTable

func SetupTable(t *testing.T, path string, commonDBsConfig DBsConfig, perUserDBsConfig PerUserDBsConfig)

func TestMultiTableQuery

func TestMultiTableQuery(t *testing.T, userID string, queries []index.Query, querier MultiTableQuerier, start, numRecords int)

func TestSingleDBQuery

func TestSingleDBQuery(t *testing.T, query index.Query, db *bbolt.DB, bucketName []byte, querier SingleDBQuerier, start, numRecords int)

func TestSingleTableQuery

func TestSingleTableQuery(t *testing.T, userID string, queries []index.Query, querier SingleTableQuerier, start, numRecords int)

Types

type DBConfig

type DBConfig struct {
	CompressFile bool
	DBRecords
}

type DBRecords

type DBRecords struct {
	Start, NumRecords int
}

type DBsConfig

type DBsConfig struct {
	DBRecordsStart                     int
	NumUnCompactedDBs, NumCompactedDBs int
}

func (DBsConfig) String

func (c DBsConfig) String() string

type MultiTableQuerier

type MultiTableQuerier interface {
	QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
}

type PerUserDBsConfig

type PerUserDBsConfig struct {
	DBsConfig
	NumUsers int
}

func (PerUserDBsConfig) String

func (c PerUserDBsConfig) String() string

type SingleDBQuerier

type SingleDBQuerier interface {
	QueryDB(ctx context.Context, db *bbolt.DB, bucketName []byte, query index.Query, callback index.QueryPagesCallback) error
}

type SingleTableQuerier

type SingleTableQuerier interface {
	MultiQueries(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error
}

Jump to

Keyboard shortcuts

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