Documentation
¶
Overview ¶
Package dockertest contains helper functions for setting up and tearing down docker containers to aid in testing.
Index ¶
- Constants
- Variables
- func IP(containerID string) (string, error)
- func KillContainer(container string) error
- func Pull(image string) error
- type ContainerID
- func OpenMongoDBContainerConnection(tries int, delay time.Duration) (c ContainerID, db *mgo.Session, err error)
- func OpenMySQLContainerConnection(tries int, delay time.Duration) (c ContainerID, db *sql.DB, err error)
- func OpenPostgreSQLContainerConnection(tries int, delay time.Duration) (c ContainerID, db *sql.DB, err error)
- func SetupMongoContainer() (c ContainerID, ip string, port int, err error)
- func SetupMySQLContainer() (c ContainerID, ip string, port int, err error)
- func SetupPostgreSQLContainer() (c ContainerID, ip string, port int, err error)
Constants ¶
const ( MySQLUsername = "root" MySQLPassword = "root" PostgresUsername = "postgres" // set up by the dockerfile of postgresImage PostgresPassword = "docker" // set up by the dockerfile of postgresImage )
Variables ¶
var Debug bool
Debug, if set, prevents any container from being removed.
var DockerMachineAvailable bool
DockerMachineAvailable, if true, uses docker-machine to run docker commands (for running tests on Windows and Mac OS)
var DockerMachineName string = "default"
DockerMachineName is the machine's name. You might want to use a dedicated machine for running your tests.
Functions ¶
func KillContainer ¶
Types ¶
type ContainerID ¶
type ContainerID string
func OpenMongoDBContainerConnection ¶
func OpenMongoDBContainerConnection(tries int, delay time.Duration) (c ContainerID, db *mgo.Session, err error)
func SetupMongoContainer ¶
func SetupMongoContainer() (c ContainerID, ip string, port int, err error)
SetupMongoContainer sets up a real MongoDB instance for testing purposes, using a Docker container. It returns the container ID and its IP address, or makes the test fail on error.
func SetupMySQLContainer ¶
func SetupMySQLContainer() (c ContainerID, ip string, port int, err error)
SetupMySQLContainer sets up a real MySQL instance for testing purposes, using a Docker container. It returns the container ID and its IP address, or makes the test fail on error. Currently using https://index.docker.io/u/orchardup/mysql/
func SetupPostgreSQLContainer ¶
func SetupPostgreSQLContainer() (c ContainerID, ip string, port int, err error)
SetupPostgreSQLContainer sets up a real PostgreSQL instance for testing purposes, using a Docker container. It returns the container ID and its IP address, or makes the test fail on error. Currently using https://index.docker.io/u/nornagon/postgres
func (ContainerID) IP ¶
func (c ContainerID) IP() (string, error)
func (ContainerID) Kill ¶
func (c ContainerID) Kill() error
func (ContainerID) KillRemove ¶
func (c ContainerID) KillRemove() error
KillRemove calls Kill on the container, and then Remove if there was no error.
func (ContainerID) Remove ¶
func (c ContainerID) Remove() error
Remove runs "docker rm" on the container
Directories
¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/camlistore.org/pkg/netutil
Package netutil identifies the system userid responsible for localhost TCP connections.
|
Package netutil identifies the system userid responsible for localhost TCP connections. |
_workspace/src/github.com/go-sql-driver/mysql
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
|
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details |
_workspace/src/github.com/lib/pq
Package pq is a pure Go Postgres driver for the database/sql package.
|
Package pq is a pure Go Postgres driver for the database/sql package. |
_workspace/src/github.com/lib/pq/listen_example
Below you will find a self-contained Go program which uses the LISTEN / NOTIFY mechanism to avoid polling the database while waiting for more work to arrive.
|
Below you will find a self-contained Go program which uses the LISTEN / NOTIFY mechanism to avoid polling the database while waiting for more work to arrive. |
_workspace/src/github.com/lib/pq/oid
Package oid contains OID constants as defined by the Postgres server.
|
Package oid contains OID constants as defined by the Postgres server. |
_workspace/src/github.com/pborman/uuid
The uuid package generates and inspects UUIDs.
|
The uuid package generates and inspects UUIDs. |
_workspace/src/github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
|
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. |
_workspace/src/gopkg.in/mgo.v2
Package mgo offers a rich MongoDB driver for Go.
|
Package mgo offers a rich MongoDB driver for Go. |
_workspace/src/gopkg.in/mgo.v2/bson
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
|
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver. |
_workspace/src/gopkg.in/mgo.v2/internal/scram
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
|
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802. |
_workspace/src/gopkg.in/mgo.v2/txn
The txn package implements support for multi-document transactions.
|
The txn package implements support for multi-document transactions. |