Documentation ¶
Overview ¶
Package dbtest contains supporting code for running tests that hit the DB.
Index ¶
Constants ¶
const ( Success = "\u2713" Failed = "\u2717" )
Success and failure markers.
Variables ¶
This section is empty.
Functions ¶
func BoolPointer ¶
BoolPointer is a helper to get a *bool from a bool. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.
func IntPointer ¶
IntPointer is a helper to get a *int from a int. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.
func NewUnit ¶
func NewUnit(t *testing.T, c *docker.Container, dbName string) (*zap.SugaredLogger, *sqlx.DB, 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 StringPointer ¶
StringPointer is a helper to get a *string from a string. It is in the tests package because we normally don't want to deal with pointers to basic types but it's useful in some tests.