Documentation ¶
Overview ¶
Package docker contains Docker-related helpers for component tests.
Index ¶
- Constants
- Variables
- func CleanupResources() error
- func CleanupSessionResources(session *Session) error
- func CleanupSessionResourcesFromFile(fname string) error
- func GetEnv() (sessionID, networkID string, err error)
- func GetFreePort() (string, error)
- func InDocker() bool
- func Retry(op func() error) error
- type BuildOptions
- type Component
- type RunOptions
- type Session
- func (s *Session) AutoServiceAddress(serviceName string) (string, error)
- func (s *Session) DockerToDockerServiceAddress(serviceName string) (string, error)
- func (s *Session) HostToDockerServiceAddress(serviceName string) (string, error)
- func (s *Session) ID() string
- func (s *Session) InDocker() bool
- func (s *Session) NetworkID() string
- func (s *Session) Persist() error
- func (s *Session) PersistToFile(fpath string) error
- func (s *Session) RegisterHostMappedDockerService(serviceName, endpoint string) error
- func (s *Session) RegisterInternalDockerService(serviceName, endpoint string) error
- func (s *Session) ServiceNames() []string
- func (s *Session) StartComponents(cs ...Component) error
- type SimpleComponent
- type SimpleContainerConfig
- type SimpleContainerOptionFunc
Constants ¶
const DefaultSessionFile = ".bakesession"
DefaultSessionFile is the file name used for storing sessions.
Variables ¶
var RetryMaxTimeout = 5 * time.Minute
RetryMaxTimeout is the timeout for the default retry func.
Functions ¶
func CleanupResources ¶ added in v0.9.4
func CleanupResources() error
CleanupResources finds all session files and prunes Docker resources associated with them.
func CleanupSessionResources ¶ added in v0.22.0
CleanupSessionResources cleans up Docker resources for a Session.
func CleanupSessionResourcesFromFile ¶ added in v0.22.0
CleanupSessionResourcesFromFile cleans up docker resources for a Session from a session file.
func GetFreePort ¶ added in v0.9.4
GetFreePort tries to find a free port on the current machine.
Types ¶
type BuildOptions ¶ added in v0.9.4
BuildOptions contains simple docker build options.
type RunOptions ¶ added in v0.28.5
RunOptions contains docker container run options.
type Session ¶ added in v0.9.4
type Session struct {
// contains filtered or unexported fields
}
Session is the docker session, used to manage the lifecycle of components.
func LoadSession ¶ added in v0.9.4
LoadSession attempts to load a Session from the default file location.
func LoadSessionFromFile ¶ added in v0.9.4
LoadSessionFromFile attempts to load a session from a file.
func NewSession ¶ added in v0.9.4
NewSession prepares a new Docker session.
func (*Session) AutoServiceAddress ¶ added in v0.9.4
AutoServiceAddress retrieves an endpoint for a service name, appropriate for the running code.
func (*Session) DockerToDockerServiceAddress ¶ added in v0.9.4
DockerToDockerServiceAddress retrieves an internal endpoint for a service name.
func (*Session) HostToDockerServiceAddress ¶ added in v0.9.4
HostToDockerServiceAddress retrieves a host mapped endpoint for a service name.
func (*Session) InDocker ¶ added in v0.19.2
InDocker indicates whether this session was started from inside a Docker container.
func (*Session) PersistToFile ¶ added in v0.9.4
PersistToFile serializes a session and writes it to a file.
func (*Session) RegisterHostMappedDockerService ¶ added in v0.17.1
RegisterHostMappedDockerService registers a host mapped endpoint against the service name.
func (*Session) RegisterInternalDockerService ¶ added in v0.17.1
RegisterInternalDockerService registers an internal endpoint against the service name.
func (*Session) ServiceNames ¶ added in v0.22.0
ServiceNames list of registered service names
func (*Session) StartComponents ¶ added in v0.9.4
StartComponents starts the provided components.
type SimpleComponent ¶ added in v0.9.4
type SimpleComponent struct { Name string Containers []SimpleContainerConfig }
SimpleComponent groups together several containers.
func (*SimpleComponent) Start ¶ added in v0.9.4
func (c *SimpleComponent) Start(session *Session) error
Start all containers sequentially.
type SimpleContainerConfig ¶ added in v0.9.4
type SimpleContainerConfig struct { Name string Repository string Tag string Env []string BuildOpts *BuildOptions ServicePorts map[string]string StaticServicePorts map[string]string ReadyFunc func(*Session) error RunOpts *RunOptions }
SimpleContainerConfig defines a Docker container with associated service ports.
type SimpleContainerOptionFunc ¶ added in v0.9.4
type SimpleContainerOptionFunc func(*SimpleContainerConfig)
SimpleContainerOptionFunc allows for customization of SimpleContainerConfigs.
func WithTag ¶ added in v0.9.4
func WithTag(tag string) SimpleContainerOptionFunc
WithTag sets a Docker tag in a SimpleContainerConfig.
Directories ¶
Path | Synopsis |
---|---|
Package component contains components for component tests.
|
Package component contains components for component tests. |
consul
Package consul exposes a Consul service and client.
|
Package consul exposes a Consul service and client. |
jaeger
Package jaeger exposes a Jaeger service.
|
Package jaeger exposes a Jaeger service. |
kafka
Package kafka exposes Kafka and Zookeeper containers.
|
Package kafka exposes Kafka and Zookeeper containers. |
localstack
Package localstack exposes a Localstack service.
|
Package localstack exposes a Localstack service. |
mockserver
Package mockserver exposes a Mockserver services.
|
Package mockserver exposes a Mockserver services. |
mongodb
Package mongodb exposes a Mongo DB service.
|
Package mongodb exposes a Mongo DB service. |
redis
Package redis exposes a Redis service.
|
Package redis exposes a Redis service. |
testservice
Package testservice exposes a simple test service.
|
Package testservice exposes a simple test service. |
Package env contains helpers to export a service's env vars with some substitution in order to replace docker-to-docker to host-to-docker addresses.
|
Package env contains helpers to export a service's env vars with some substitution in order to replace docker-to-docker to host-to-docker addresses. |