Documentation
¶
Index ¶
- Constants
- Variables
- func DoubledPort(port string) string
- func GetAbsPath(relativePath string) string
- func GetAuthRegistryCredStr() string
- func NewCQLSHContainer(ctx context.Context, cfg CassandraConfig, ...) (testcontainers.Container, error)
- func NewCassandraContainer(ctx context.Context, cfg CassandraConfig, ...) (testcontainers.Container, error)
- func NewMigrationsContainer(ctx context.Context, cfg CassandraConfig, ...) (testcontainers.Container, error)
- func PullDockerImage(ctx context.Context, imageName string) error
- func TerminateIfNotNil(ctx context.Context, container Terminated) error
- type BaseContainerConfig
- type CassandraCluster
- type CassandraConfig
- type Container
- func NewGenericContainer(ctx context.Context, cfg BaseContainerConfig, dockerNetwork *DockerNetwork) (Container, error)
- func NewKafkaContainer(ctx context.Context, cfg KafkaConfig, dockerNetwork *DockerNetwork) (Container, error)
- func NewNginxContainer(ctx context.Context, cfg NginxConfig, ...) (Container, error)
- func NewPostgresContainer(ctx context.Context, cfg PostgresConfig, dockerNetwork *DockerNetwork) (Container, error)
- func NewRedisContainer(ctx context.Context, cfg NginxConfig, ...) (Container, error)
- func NewZookeeperContainer(ctx context.Context, cfg ZookeeperConfig, dockerNetwork *DockerNetwork) (Container, error)
- type ContainerFile
- type ContainerRequest
- type DockerNetwork
- type GenericContainerRequest
- type GenericNetworkRequest
- type KafkaCluster
- type KafkaConfig
- type Network
- type NetworkRequest
- type NginxConfig
- type PostgresConfig
- type RedisConfig
- type Terminated
- type ZookeeperConfig
Constants ¶
const IsSkipReaperImage = false // not skip usage reaper image on CI
IsSkipReaperImage - is skip usage Reaper Image.
const NoUseAuth = ""
NoUseAuth - not used any docker auth.
const ReaperImage = "" // use standard Reaper Image.
ReaperImage - is very important to re-define because by default testcontainers lib use reaper image based on docker.io -> https://github.com/testcontainers/testcontainers-go/blob/6ba6e7a0e4b0046507c28e24946d595a65a96dbf/reaper.go#L24
const RegistryTokenEnv = "" // not use any docker registry token for docker demon.
RegistryTokenEnv - env with docker registry token from dp.
Variables ¶
var ( GenericContainer = testcontainers.GenericContainer GenericNetwork = testcontainers.GenericNetwork Mounts = testcontainers.Mounts BindMount = testcontainers.BindMount )
Func aliasing - for reduce code line size. Remove external deps from other places too.
Functions ¶
func DoubledPort ¶ added in v1.7.2
DoubledPort - helper func for prepare port mapping.
func GetAbsPath ¶ added in v1.7.2
GetAbsPath - get absolute path based on pwd and relative path.
func GetAuthRegistryCredStr ¶ added in v1.6.9
func GetAuthRegistryCredStr() string
GetAuthRegistryCredStr - return auth encoded string for docker registry.
func NewCQLSHContainer ¶
func NewCQLSHContainer( ctx context.Context, cfg CassandraConfig, dockerNetwork *testcontainers.DockerNetwork, cassandraHost string, cassandraPort string, ) (testcontainers.Container, error)
NewCQLSHContainer - create docker container with cql sh (for before migration query script set up).
func NewCassandraContainer ¶
func NewCassandraContainer( ctx context.Context, cfg CassandraConfig, dockerNetwork *testcontainers.DockerNetwork, ) (testcontainers.Container, error)
NewCassandraContainer - create cassandra container, but do not start it yet.
func NewMigrationsContainer ¶
func NewMigrationsContainer( ctx context.Context, cfg CassandraConfig, dockerNetwork *testcontainers.DockerNetwork, cassandraHost string, cassandraPort string, ) (testcontainers.Container, error)
NewMigrationsContainer - create docker container for migrations.
func PullDockerImage ¶
PullDockerImage - pull docker image via docker client.
func TerminateIfNotNil ¶ added in v1.6.9
func TerminateIfNotNil(ctx context.Context, container Terminated) error
Types ¶
type BaseContainerConfig ¶
type BaseContainerConfig struct { Name string // Hostname, ContainerName, Network alias Image string Port string Files []ContainerFile Binds []string Envs map[string]string Cmd []string ExposedPorts []string AutoRemove bool WaitingForStrategy wait.Strategy }
BaseContainerConfig - base container request config.
type CassandraCluster ¶
type CassandraCluster struct {
// contains filtered or unexported fields
}
CassandraCluster - cassandra cluster struct.
func NewCassandraCluster ¶
func NewCassandraCluster( ctx context.Context, cfg CassandraConfig, dockerNetwork *testcontainers.DockerNetwork, ) (*CassandraCluster, error)
NewCassandraCluster -create new CassandraCluster.
type CassandraConfig ¶
type CassandraConfig struct { BaseContainerConfig ContainerWarmUpTimeout time.Duration BeforeMigrationsTimeout time.Duration AfterMigrationsTimeout time.Duration CqlshImage string PathToCqlshQueryScript string MigrationImage string PathToMigrationsDir string }
CassandraConfig - cassandra container config.
type Container ¶ added in v1.6.9
type Container = testcontainers.Container
Type Aliasing for reduce code line size. Remove external deps from other places too.
func NewGenericContainer ¶ added in v1.6.9
func NewGenericContainer(ctx context.Context, cfg BaseContainerConfig, dockerNetwork *DockerNetwork) (Container, error)
NewGenericContainer - create new generic container with BaseContainerConfig and DockerNetwork.
func NewKafkaContainer ¶
func NewKafkaContainer( ctx context.Context, cfg KafkaConfig, dockerNetwork *DockerNetwork, ) (Container, error)
NewKafkaContainer - create new kafka container, but do not start it yet.
func NewNginxContainer ¶
func NewNginxContainer( ctx context.Context, cfg NginxConfig, dockerNetwork *testcontainers.DockerNetwork, ) (Container, error)
NewNginxContainer - create nginx container, but do not start it yet.
func NewPostgresContainer ¶
func NewPostgresContainer( ctx context.Context, cfg PostgresConfig, dockerNetwork *DockerNetwork, ) (Container, error)
NewPostgresContainer - create postgres container, but do not start it yet.
func NewRedisContainer ¶
func NewRedisContainer( ctx context.Context, cfg NginxConfig, dockerNetwork *testcontainers.DockerNetwork, ) (Container, error)
NewRedisContainer - create redis container, but do not start it yet.
func NewZookeeperContainer ¶
func NewZookeeperContainer( ctx context.Context, cfg ZookeeperConfig, dockerNetwork *DockerNetwork, ) (Container, error)
NewZookeeperContainer - create zookeeper container, but do not start it yet.
type ContainerFile ¶ added in v1.6.9
type ContainerFile = testcontainers.ContainerFile
Type Aliasing for reduce code line size. Remove external deps from other places too.
type ContainerRequest ¶ added in v1.6.9
type ContainerRequest = testcontainers.ContainerRequest
Type Aliasing for reduce code line size. Remove external deps from other places too.
func GetBaseContainerRequest ¶
func GetBaseContainerRequest( cfg BaseContainerConfig, dockerNetwork *DockerNetwork, ) ContainerRequest
GetBaseContainerRequest - return base ContainerRequest.
type DockerNetwork ¶ added in v1.6.9
type DockerNetwork = testcontainers.DockerNetwork
Type Aliasing for reduce code line size. Remove external deps from other places too.
type GenericContainerRequest ¶ added in v1.6.9
type GenericContainerRequest = testcontainers.GenericContainerRequest
Type Aliasing for reduce code line size. Remove external deps from other places too.
type GenericNetworkRequest ¶ added in v1.6.9
type GenericNetworkRequest = testcontainers.GenericNetworkRequest
Type Aliasing for reduce code line size. Remove external deps from other places too.
type KafkaCluster ¶
type KafkaCluster struct { KafkaContainer Container ZookeeperContainer Container KafkaURI string // contains filtered or unexported fields }
KafkaCluster - kafka cluster struct (together kafka container and zookeeper).
func NewKafkaCluster ¶
func NewKafkaCluster( ctx context.Context, kafkaCfg KafkaConfig, zooCfg ZookeeperConfig, dockerNetwork *DockerNetwork, ) (*KafkaCluster, error)
NewKafkaCluster - create new kafka cluster (together kafka container + zookeeper), but do not start it yet.
type KafkaConfig ¶
type KafkaConfig struct { ClientPort string BrokerPort string BaseContainerConfig }
KafkaConfig - kafka container config with zookeeper.
type Network ¶ added in v1.6.9
type Network = testcontainers.Network
Type Aliasing for reduce code line size. Remove external deps from other places too.
type NetworkRequest ¶ added in v1.6.9
type NetworkRequest = testcontainers.NetworkRequest
Type Aliasing for reduce code line size. Remove external deps from other places too.
type NginxConfig ¶
type NginxConfig struct {
BaseContainerConfig
}
NginxConfig - nginx container config.
type PostgresConfig ¶
type PostgresConfig struct {
BaseContainerConfig
}
PostgresConfig - postgres container config.
type RedisConfig ¶
type RedisConfig struct {
BaseContainerConfig
}
RedisConfig - redis container config.
type Terminated ¶ added in v1.6.9
type ZookeeperConfig ¶
type ZookeeperConfig struct {
BaseContainerConfig
}
ZookeeperConfig - zookeeper container config.