Documentation ¶
Overview ¶
Package dockertestx is wrapper of ory/dockertest.
dockertestx provides ready specific persistent and containers management to reuse.
Index ¶
Examples ¶
Constants ¶
View Source
const ( S3AWSAccessKeyID = "AKIAIOSFODNN7DUMMY" // #nosec S3AWSSecretAccessKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYDUMMYKEY" // #nosec )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerFactory ¶
type ContainerFactory interface {
// contains filtered or unexported methods
}
ContainerFactory represents how to create docker container
type ContainerOption ¶
type DynamoDBFactory ¶
type DynamoDBFactory struct{}
type Pool ¶
type Pool struct { *dockertest.Pool // contains filtered or unexported fields }
Pool represents a connection to the docker API and is used to create and remove docker images.
func New ¶
func New(opt PoolOption) (*Pool, error)
New Pool instance
Example ¶
package main import ( "database/sql" "log" "github.com/tier4/x-go/dockertestx" ) func main() { p, err := dockertestx.New(dockertestx.PoolOption{}) if err != nil { // handle error return } defer func(p *dockertestx.Pool) { err := p.Purge() if err != nil { log.Fatalln(err) } }(p) dsn, err := p.NewResource(new(dockertestx.PostgresFactory), dockertestx.ContainerOption{ Tag: "13-alpine", }) if err != nil { // handle error return } db, err := sql.Open("postgres", dsn) if err != nil { // handle error return } defer db.Close() }
Output:
func (*Pool) ForcePurge ¶
ForcePurge regardless KeepContainer option
func (*Pool) NewResource ¶
func (p *Pool) NewResource(factory ContainerFactory, opt ContainerOption) (string, error)
type PoolOption ¶
type PostgresFactory ¶
type PostgresFactory struct{}
type PrismFactory ¶
type SQSFactory ¶
type SQSFactory struct{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.