camlistore.org: camlistore.org/pkg/test/dockertest Index | Files

package dockertest

import "camlistore.org/pkg/test/dockertest"

Package dockertest contains helper functions for setting up and tearing down docker containers to aid in testing.

Index

Package Files

docker.go

Constants

const (
    MySQLUsername = "root"
    MySQLPassword = "root"

    PostgresUsername = "docker" // 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.

func IP Uses

func IP(containerID string) (string, error)

IP returns the IP address of the container.

func KillContainer Uses

func KillContainer(container string) error

func Pull Uses

func Pull(image string) error

Pull retrieves the docker image with 'docker pull'.

type ContainerID Uses

type ContainerID string

func SetupFakeS3Container Uses

func SetupFakeS3Container(t *testing.T) (c ContainerID, ip string)

func SetupMongoContainer Uses

func SetupMongoContainer(t *testing.T) (c ContainerID, ip string)

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. Currently using https://index.docker.io/u/robinvdvleuten/mongo/

func SetupMySQLContainer Uses

func SetupMySQLContainer(t *testing.T, dbname string) (c ContainerID, ip string)

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://hub.docker.com/_/mysql/

func SetupPostgreSQLContainer Uses

func SetupPostgreSQLContainer(t *testing.T, dbname string) (c ContainerID, ip string)

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 Uses

func (c ContainerID) IP() (string, error)

func (ContainerID) Kill Uses

func (c ContainerID) Kill() error

func (ContainerID) KillRemove Uses

func (c ContainerID) KillRemove(t *testing.T)

KillRemove calls Kill on the container, and then Remove if there was no error. It logs any error to t.

func (ContainerID) Remove Uses

func (c ContainerID) Remove() error

Remove runs "docker rm" on the container

Package dockertest imports 15 packages (graph). Updated 2018-01-20. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).