dbtest

package
v0.0.0-...-43a32cb Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success = "\u2713"
	Failed  = "\u2717"
)

Success and failure markers.

Variables

This section is empty.

Functions

func NewUnit

func NewUnit(t *testing.T, c *docker.Container) (*logrus.Logger, *database.MongoDb, func())

NewUnit creates a test database inside a Docker container. It creates the required table structure but the database is otherwise empty. It returns the database to use as well as a function to call at the end of the test.

func StartDB

func StartDB() (*docker.Container, error)

StartDB starts a database instance.

func StopDB

func StopDB(c *docker.Container)

StopDB stops a running database instance.

Types

type Test

type Test struct {
	DB       *database.MongoDb
	Log      *logrus.Logger
	Teardown func()
	// contains filtered or unexported fields
}

Test owns state for running and shutting down tests.

func NewIntegration

func NewIntegration(t *testing.T, c *docker.Container) *Test

NewIntegration creates a database, seeds it, constructs an authenticator.

Jump to

Keyboard shortcuts

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