integration

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package integration is a helper for running integration tests.

Index

Constants

View Source
const (
	DefaultDSN = `host=localhost port=5434 user=claircore dbname=claircore sslmode=disable`
)

DefaultDSN is a dsn for database server usually set up by the project's Makefile.

Variables

This section is empty.

Functions

func Skip

func Skip(t testing.TB)

Skip will skip the current test or benchmark if this package was built without the "integration" build tag.

This should be used as an annotation at the top of the function, like (*testing.T).Parallel().

func TestThatTouchesNetwork(t *testing.T) {
	t.Parallel()
	integration.Skip(t)
	// ...
}

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB is a handle for connecting to an cleaning up a created database.

func NewDB

func NewDB(ctx context.Context, t testing.TB, dsn string) (*DB, error)

NewDB creates a new database and populates it with the contents of initfile.

func (*DB) Close

func (db *DB) Close(ctx context.Context, t testing.TB)

Close tears down the created database.

func (*DB) Config

func (db *DB) Config() *pgxpool.Config

Config returns a pgxpool.Config for the created database.

Jump to

Keyboard shortcuts

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