dockertestenv

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

package dockertestenv provides test environment where service dependencies are docker containers

Index

Constants

View Source
const (
	PGBouncerPort = 30229

	DefaultPostgresPassword = "correcthorsebatterystable"
	DefaultPostgresUser     = "pachyderm"
	DefaultPostgresDatabase = "pachyderm"
)
View Source
const (
	MySQLPassword = "root"
)

Variables

This section is empty.

Functions

func EnsureDBEnv added in v2.9.0

func EnsureDBEnv(ctx context.Context) error

TODO: use the docker client, instead of the bash script TODO: use the bitnami pg_bouncer image TODO: look into https://github.com/ory/dockertest

func NewEphemeralMySQLDB

func NewEphemeralMySQLDB(ctx context.Context, t testing.TB) (*pachsql.DB, string)

func NewEphemeralPostgresDB

func NewEphemeralPostgresDB(ctx context.Context, t testing.TB) (*pachsql.DB, string)

NewEphemeralPostgresDB creates a randomly-named new database, returning a connection to the new DB and the name itself.

func NewMySQLURL

func NewMySQLURL(ctx context.Context, t testing.TB) pachsql.URL

NewMySQLURL returns a pachsql.URL to an ephemeral database.

func NewTestBucket

func NewTestBucket(ctx context.Context, t testing.TB) (*blob.Bucket, string)

func NewTestDB

func NewTestDB(t testing.TB) *pachsql.DB

NewTestDB creates a new database connection scoped to the test.

func NewTestDirectDB added in v2.8.0

func NewTestDirectDB(t testing.TB) *pachsql.DB

func PGBouncerHost

func PGBouncerHost() string

Types

type DBConfig added in v2.8.0

type DBConfig struct {
	Direct    PostgresConfig
	PGBouncer PostgresConfig
	Identity  PostgresConfig
}

func NewTestDBConfig

func NewTestDBConfig(t testing.TB) DBConfig

NewTestDBConfig returns a DBConfig for a test environment The environment will be torn down at the end of the test.

func (DBConfig) PachConfigOption added in v2.8.0

func (dbc DBConfig) PachConfigOption(c *pachconfig.Configuration)

type PostgresConfig added in v2.8.0

type PostgresConfig struct {
	Host     string
	Port     uint16
	User     string
	Password string

	DBName string
}

func (PostgresConfig) DBOptions added in v2.8.0

func (pgc PostgresConfig) DBOptions() []dbutil.Option

Jump to

Keyboard shortcuts

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