testingx

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostgresUserinfo = url.UserPassword("postgres", "password")
View Source
var ReadWriteUserinfo = url.UserPassword("read_write", "password")

Functions

func BackoffWithTimeout

func BackoffWithTimeout(
	tctx context.Context,
	timeout *time.Duration,
) backoff.BackOffContext

func CheckErrFatal

func CheckErrFatal(err error)

func Context

func Context() context.Context

func NewPostgresDB

func NewPostgresDB(
	ctx context.Context,
	manager *container.Manager,
	params NewPostgresDBParams,
) (dsn *url.URL, err error)

func NewWorkspaceFileStore

func NewWorkspaceFileStore(ctx context.Context) (store *config.FileStore, err error)

func SetupPostgresDatabaseConnection

func SetupPostgresDatabaseConnection(
	ctx context.Context,
	params SetupPostgresDatabaseConnectionParams,
) (dsn *url.URL, err error)

func SetupTestMainWithDB

func SetupTestMainWithDB(
	m *testing.M,
	params SetupTestMainWithDBParams,
)

func WaitForPostgres

func WaitForPostgres(ctx context.Context, db *sql.DB, timeout *time.Duration) container.StartOption

Types

type Connection

type Connection struct {
	DB  *sqlx.DB
	URL *url.URL
}

func GetDB

func GetDB() (Connection, error)

type MigrationProvider

type MigrationProvider func(dsn string) (*migrate.Migrate, error)

type NewPostgresDBParams

type NewPostgresDBParams struct {
	Database      string
	ImageURL      string
	ContainerName string
	Timeout       *time.Duration
}

type SetupPostgresDatabaseConnectionParams

type SetupPostgresDatabaseConnectionParams struct {
	Manager        *container.Manager
	LoadMigrations MigrationProvider
	ContainerName  string
	DatabaseName   string
}

type SetupTestMainWithDBParams

type SetupTestMainWithDBParams struct {
	LoadMigrations MigrationProvider
	ContainerName  string
	DatabaseName   string
}

Jump to

Keyboard shortcuts

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