satellitedbtest

package
v1.109.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: AGPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bench added in v0.12.0

func Bench(b *testing.B, bench func(ctx *testcontext.Context, b *testing.B, db satellite.DB))

Bench method will iterate over all supported databases. Will establish connection and will create tables for each DB.

func CreateMasterDB added in v0.27.0

func CreateMasterDB(ctx context.Context, log *zap.Logger, name string, category string, index int, dbInfo Database, applicationName string) (db satellite.DB, err error)

CreateMasterDB creates a new satellite database for testing.

func CreateMasterDBOnTopOf added in v0.27.0

func CreateMasterDBOnTopOf(ctx context.Context, log *zap.Logger, tempDB *dbutil.TempDatabase, applicationName string) (db satellite.DB, err error)

CreateMasterDBOnTopOf creates a new satellite database on top of an already existing temporary database.

func CreateMetabaseDB added in v1.26.2

func CreateMetabaseDB(ctx context.Context, log *zap.Logger, name string, category string, index int, dbInfo Database, config metabase.Config) (db *metabase.DB, err error)

CreateMetabaseDB creates a new satellite metabase for testing.

func CreateMetabaseDBOnTopOf added in v1.26.2

func CreateMetabaseDBOnTopOf(ctx context.Context, log *zap.Logger, tempDB *dbutil.TempDatabase, config metabase.Config) (*metabase.DB, error)

CreateMetabaseDBOnTopOf creates a new metabase on top of an already existing temporary database.

func CreateTempDB added in v1.102.2

func CreateTempDB(ctx context.Context, log *zap.Logger, tcfg TempDBSchemaConfig, dbInfo Database) (db *dbutil.TempDatabase, err error)

CreateTempDB creates a new temporary database (Cockroach or Postgresql).

func Run

func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, db satellite.DB), configOptions ...ConfigOption)

Run method will iterate over all supported databases. Will establish connection and will create tables for each DB.

func SchemaName added in v0.24.0

func SchemaName(testname, category string, index int, schemaSuffix string) string

SchemaName returns a properly formatted schema string.

func SchemaSuffix added in v0.24.0

func SchemaSuffix() string

SchemaSuffix returns a suffix for schemas.

Types

type ConfigOption added in v1.109.1

type ConfigOption func(c *config)

ConfigOption modifies a satellitedbtest configuration to provide test specific options.

func WithSpanner added in v1.109.1

func WithSpanner() ConfigOption

WithSpanner configures config to enable tests to run on spanner.

type Database

type Database struct {
	Name    string
	URL     string
	Message string
}

Database describes a test database.

type SatelliteDatabases added in v0.23.0

type SatelliteDatabases struct {
	Name       string
	MasterDB   Database
	MetabaseDB Database
}

SatelliteDatabases maybe name can be better.

func Databases

func Databases() []SatelliteDatabases

Databases returns default databases.

type TempDBSchemaConfig added in v1.102.2

type TempDBSchemaConfig struct {
	Name     string
	Category string
	Index    int
}

TempDBSchemaConfig defines parameters required for the temp database.

Jump to

Keyboard shortcuts

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