dockertest

package
v0.0.0-...-398cf1c Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectPop

func ConnectPop(t require.TestingT, url string) (c *pop.Connection)

func ConnectToTestCockroachDB

func ConnectToTestCockroachDB() (*sqlx.DB, error)

ConnectToTestCockroachDB connects to a CockroachDB database.

func ConnectToTestCockroachDBPop

func ConnectToTestCockroachDBPop(t testing.TB) *pop.Connection

ConnectToTestCockroachDBPop connects to a test CockroachDB database. If a docker container is started for the database, the container be removed at the end of the test.

func ConnectToTestMySQL

func ConnectToTestMySQL() (*sqlx.DB, error)

ConnectToTestMySQL connects to a MySQL database.

func ConnectToTestMySQLPop

func ConnectToTestMySQLPop(t testing.TB) *pop.Connection

func ConnectToTestPostgreSQL

func ConnectToTestPostgreSQL() (*sqlx.DB, error)

ConnectToTestPostgreSQL connects to a PostgreSQL database.

func ConnectToTestPostgreSQLPop

func ConnectToTestPostgreSQLPop(t testing.TB) *pop.Connection

ConnectToTestPostgreSQLPop connects to a test PostgreSQL database. If a docker container is started for the database, the container be removed at the end of the test.

func DumpSchema

func DumpSchema(ctx context.Context, t *testing.T, db string) string

func KillAllTestDatabases

func KillAllTestDatabases()

KillAllTestDatabases deletes all test databases.

func NewLocalTestCRDBServer

func NewLocalTestCRDBServer(t testing.TB) string

func Parallel

func Parallel(fs []func())

Parallel runs tasks in parallel.

func RunCockroachDB

func RunCockroachDB() (string, error)

RunCockroachDB runs a CockroachDB database and returns the URL to it.

func RunCockroachDBWithVersion

func RunCockroachDBWithVersion(version string) (string, error)

RunCockroachDBWithVersion runs a CockroachDB database with the specified version and returns the URL to it.

func RunMySQL

func RunMySQL() (string, error)

RunMySQL runs a RunMySQL database and returns the URL to it.

func RunPostgreSQL

func RunPostgreSQL() (string, error)

RunPostgreSQL runs a PostgreSQL database and returns the URL to it.

func RunTestCockroachDB

func RunTestCockroachDB(t testing.TB) string

RunTestCockroachDB runs a CockroachDB database and returns the URL to it. If a docker container is started for the database, the container be removed at the end of the test.

func RunTestCockroachDBWithVersion

func RunTestCockroachDBWithVersion(t testing.TB, version string) string

RunTestCockroachDB runs a CockroachDB database and returns the URL to it. If a docker container is started for the database, the container be removed at the end of the test.

func RunTestMySQL

func RunTestMySQL(t testing.TB) string

RunTestMySQL runs a MySQL database and returns the URL to it. If a docker container is started for the database, the container be removed at the end of the test.

func RunTestMySQLWithVersion

func RunTestMySQLWithVersion(t testing.TB, version string) string

RunTestMySQLWithVersion runs a MySQL database in the specified version and returns the URL to it. If a docker container is started for the database, the container be removed at the end of the test.

func RunTestPostgreSQL

func RunTestPostgreSQL(t testing.TB) string

RunTestPostgreSQL runs a PostgreSQL database and returns the URL to it. If a docker container is started for the database, the container be removed at the end of the test.

func RunTestPostgreSQLWithVersion

func RunTestPostgreSQLWithVersion(t testing.TB, version string) string

RunTestPostgreSQLWithVersion connects to a PostgreSQL database .

func StripDump

func StripDump(d string) string

Types

type OnExit

type OnExit struct {
	sync.Mutex
	// contains filtered or unexported fields
}

OnExit helps with cleaning up docker test.

func NewOnExit

func NewOnExit() *OnExit

NewOnExit create a new OnExit instance.

func Register

func Register() *OnExit

Register sets up OnExit.

func (*OnExit) Add

func (at *OnExit) Add(f func())

Add adds a task that is executed on SIGINT, SIGKILL, SIGTERM.

func (*OnExit) Exit

func (at *OnExit) Exit(status int)

Exit wraps os.Exit

Jump to

Keyboard shortcuts

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