Documentation
¶
Index ¶
- func GetPortMapping(internal, external int) string
- type ContainerConfig
- type ContainerLifecycleManager
- func (c *ContainerLifecycleManager) GetContainer(containerID string) (*DockerContainer, error)
- func (c *ContainerLifecycleManager) ListContainers() map[string]*DockerContainer
- func (c *ContainerLifecycleManager) PortManager() *PortManager
- func (c *ContainerLifecycleManager) RegisterContainer(dockerContainer *DockerContainer)
- func (c *ContainerLifecycleManager) StartAll(ctx context.Context) error
- func (c *ContainerLifecycleManager) StopAll(ctx context.Context) error
- func (c *ContainerLifecycleManager) UnregisterContainer(containerID string)
- type DockerContainer
- func (d *DockerContainer) Config() *ContainerConfig
- func (d *DockerContainer) ConnectionString() string
- func (d *DockerContainer) Container() testcontainers.Container
- func (d *DockerContainer) Exec(ctx context.Context, cmd []string) error
- func (d *DockerContainer) HealthCheck(ctx context.Context) error
- func (d *DockerContainer) Host() string
- func (d *DockerContainer) ID() string
- func (d *DockerContainer) Image() string
- func (d *DockerContainer) IsRunning() bool
- func (d *DockerContainer) Logs(ctx context.Context) (io.Reader, error)
- func (d *DockerContainer) Name() string
- func (d *DockerContainer) Port(internal int) (int, error)
- func (d *DockerContainer) SetContainer(c testcontainers.Container)
- func (d *DockerContainer) Start(ctx context.Context) error
- func (d *DockerContainer) Stop(ctx context.Context) error
- func (d *DockerContainer) WaitForReady(ctx context.Context, timeout time.Duration) error
- type PortManager
- func (p *PortManager) AllocatePort(containerID string, port int)
- func (p *PortManager) DeallocateAllPorts(containerID string)
- func (p *PortManager) DeallocatePort(containerID string, port int)
- func (p *PortManager) GetAllocatedPorts(containerID string) []int
- func (p *PortManager) IsPortAllocated(port int) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPortMapping ¶
GetPortMapping returns a formatted port mapping string
Types ¶
type ContainerConfig ¶
type ContainerConfig struct {
ID string
Name string
Image string
Environment map[string]string
Ports []container.PortMapping
}
ContainerConfig holds basic container configuration
type ContainerLifecycleManager ¶
type ContainerLifecycleManager struct {
// contains filtered or unexported fields
}
ContainerLifecycleManager manages container lifecycle operations
func NewContainerLifecycleManager ¶
func NewContainerLifecycleManager() *ContainerLifecycleManager
NewContainerLifecycleManager creates a new container lifecycle manager
func (*ContainerLifecycleManager) GetContainer ¶
func (c *ContainerLifecycleManager) GetContainer(containerID string) (*DockerContainer, error)
GetContainer returns a container by ID
func (*ContainerLifecycleManager) ListContainers ¶
func (c *ContainerLifecycleManager) ListContainers() map[string]*DockerContainer
ListContainers returns all registered containers
func (*ContainerLifecycleManager) PortManager ¶
func (c *ContainerLifecycleManager) PortManager() *PortManager
PortManager returns the port manager
func (*ContainerLifecycleManager) RegisterContainer ¶
func (c *ContainerLifecycleManager) RegisterContainer(dockerContainer *DockerContainer)
RegisterContainer registers a container for lifecycle management
func (*ContainerLifecycleManager) StartAll ¶
func (c *ContainerLifecycleManager) StartAll(ctx context.Context) error
StartAll starts all registered containers
func (*ContainerLifecycleManager) StopAll ¶
func (c *ContainerLifecycleManager) StopAll(ctx context.Context) error
StopAll stops all registered containers
func (*ContainerLifecycleManager) UnregisterContainer ¶
func (c *ContainerLifecycleManager) UnregisterContainer(containerID string)
UnregisterContainer unregisters a container from lifecycle management
type DockerContainer ¶
type DockerContainer struct {
// contains filtered or unexported fields
}
DockerContainer wraps testcontainers.Container with additional configuration
func NewDockerContainer ¶
func NewDockerContainer(config *ContainerConfig) *DockerContainer
NewDockerContainer creates a new DockerContainer with the given configuration
func (*DockerContainer) Config ¶
func (d *DockerContainer) Config() *ContainerConfig
Config returns the container configuration
func (*DockerContainer) ConnectionString ¶
func (d *DockerContainer) ConnectionString() string
ConnectionString returns the connection string for the container
func (*DockerContainer) Container ¶
func (d *DockerContainer) Container() testcontainers.Container
Container returns the underlying testcontainers.Container
func (*DockerContainer) Exec ¶
func (d *DockerContainer) Exec(ctx context.Context, cmd []string) error
Exec executes a command in the container
func (*DockerContainer) HealthCheck ¶
func (d *DockerContainer) HealthCheck(ctx context.Context) error
HealthCheck performs a health check on the container
func (*DockerContainer) Host ¶
func (d *DockerContainer) Host() string
Host returns the host address where the container is accessible
func (*DockerContainer) ID ¶
func (d *DockerContainer) ID() string
ID returns the unique identifier of the container
func (*DockerContainer) Image ¶
func (d *DockerContainer) Image() string
Image returns the image of the container
func (*DockerContainer) IsRunning ¶
func (d *DockerContainer) IsRunning() bool
IsRunning returns true if the container is currently running
func (*DockerContainer) Name ¶
func (d *DockerContainer) Name() string
Name returns the name of the container
func (*DockerContainer) Port ¶
func (d *DockerContainer) Port(internal int) (int, error)
Port returns the mapped external port for the given internal port
func (*DockerContainer) SetContainer ¶
func (d *DockerContainer) SetContainer(c testcontainers.Container)
SetContainer sets the underlying testcontainers.Container
func (*DockerContainer) Start ¶
func (d *DockerContainer) Start(ctx context.Context) error
Start starts the container
func (*DockerContainer) Stop ¶
func (d *DockerContainer) Stop(ctx context.Context) error
Stop stops the container
func (*DockerContainer) WaitForReady ¶
WaitForReady waits for the container to be ready with a timeout
type PortManager ¶
type PortManager struct {
// contains filtered or unexported fields
}
PortManager manages port mappings and allocations
func (*PortManager) AllocatePort ¶
func (p *PortManager) AllocatePort(containerID string, port int)
AllocatePort allocates a port for a container
func (*PortManager) DeallocateAllPorts ¶
func (p *PortManager) DeallocateAllPorts(containerID string)
DeallocateAllPorts deallocates all ports for a container
func (*PortManager) DeallocatePort ¶
func (p *PortManager) DeallocatePort(containerID string, port int)
DeallocatePort deallocates a port for a container
func (*PortManager) GetAllocatedPorts ¶
func (p *PortManager) GetAllocatedPorts(containerID string) []int
GetAllocatedPorts returns all allocated ports for a container
func (*PortManager) IsPortAllocated ¶
func (p *PortManager) IsPortAllocated(port int) bool
IsPortAllocated checks if a port is allocated for any container