Documentation ¶
Index ¶
- func MustRun(t *testing.T, name string, fn func(*testing.T, *mongo.Database))
- func Run(t *testing.T, name string, fn func(*testing.T, *mongo.Database)) error
- func RunWithDatabase(t *testing.T, name string, db *mongo.Database, ...)
- func Setup(req mc.ContainerRequest) error
- func TearDown() error
- type TestingDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustRun ¶
MustRun creates a test using the given name. A new mongo.Database will be created against the TestingDB.container using the given name. The new test simply runs fn injecting the new mongo.Database.
If a database cannot be created, t.Fatal is called.
func Run ¶
Run creates a test using the given name. A new mongo.Database will be created against the TestingDB.container using the given name. The new test simply runs fn injecting the new mongo.Database.
Returns an error if a database cannot be created.
func RunWithDatabase ¶
func RunWithDatabase(t *testing.T, name string, db *mongo.Database, fn func(*testing.T, *mongo.Database))
RunWithDatabase creates a test using the given database's name. The new test simply runs fn injecting db. Use this function if you need to customize the database with custom options.
func Setup ¶
func Setup(req mc.ContainerRequest) error
Types ¶
type TestingDB ¶
type TestingDB struct {
// contains filtered or unexported fields
}
TestingDB - An object to store the container reference.
func NewTestDB ¶
func NewTestDB(req mc.ContainerRequest) (*TestingDB, error)
NewTestDB provides an entry point for you to config the mongo container.
func (*TestingDB) MustRun ¶
MustRun creates a test using the given name. A new mongo.Database will be created against the TestingDB.container using the given name. The new test simply runs fn injecting the new mongo.Database.
If a database cannot be created, t.Fatal is called.