testutil

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(t *testing.T, txt string, a ...interface{})

func Fatalf

func Fatalf(t *testing.T, txt string, a ...interface{})

func Given

func Given(t *testing.T, txt string)

func GivenF

func GivenF(t *testing.T, txt string, a ...interface{})

func Successf

func Successf(t *testing.T, txt string, a ...interface{})

func WhenF

func WhenF(t *testing.T, txt string, a ...interface{})

Types

type Server

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

A Server represents a running PostgreSQL server.

func InitTestDBConn

func InitTestDBConn() (*Server, error)

InitTestDBConn creates a connection to the postgres user and creates the Server struct. This is used to create all other test databases and should be executed once at the top of a test file (in the Main function).

func (*Server) Cleanup

func (srv *Server) Cleanup() error

Cleanup closes the connection to the connection to the postgres server used to create new test databases. This should only be used once for each test file.

func (*Server) NewTestDatabase

func (srv *Server) NewTestDatabase(migrate bool) (*sqlx.DB, error)

NewTestDatabase opens a connection to a freshly created database on the server.

Jump to

Keyboard shortcuts

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