satellitedbtest

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: AGPL-3.0 Imports: 11 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(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 NewPostgres added in v0.24.0

func NewPostgres(log *zap.Logger, schema string) (satellite.DB, error)

NewPostgres returns the default postgres satellite.DB for testing.

func PostgresDefined added in v0.26.0

func PostgresDefined() error

PostgresDefined returns an error when the --postgres-test-db or STORJ_POSTGRES_TEST is not set for tests.

func Run

func Run(t *testing.T, test func(t *testing.T, db satellite.DB))

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 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 {
	MasterDB  Database
	PointerDB Database
}

SatelliteDatabases maybe name can be better

func Databases

func Databases() []SatelliteDatabases

Databases returns default databases.

type SchemaDB added in v0.24.0

type SchemaDB struct {
	satellite.DB

	Schema   string
	AutoDrop bool
}

SchemaDB implements automatic schema handling for satellite.DB

func (*SchemaDB) Close added in v0.24.0

func (db *SchemaDB) Close() error

Close closes the database and drops the schema, when `AutoDrop` is set.

func (*SchemaDB) CreateTables added in v0.24.0

func (db *SchemaDB) CreateTables() error

CreateTables creates the schema and creates tables.

func (*SchemaDB) TestDBAccess added in v0.24.0

func (db *SchemaDB) TestDBAccess() *dbx.DB

TestDBAccess for raw database access, should not be used outside of migration tests.

Jump to

Keyboard shortcuts

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