infra

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMongo     = "test-mongo"
	DefaultRedis     = "test-redis"
	DefaultKafka     = "test-kafka"
	DefaultZookeeper = "test-zoo"
	DefaultNetwork   = "test-network"
)

Variables

This section is empty.

Functions

func BridgeNetwork

func BridgeNetwork(_ context.Context, name string) (testcontainers.Network, error)

func Mongo

func Mongo(ctx context.Context, opts ...MongoOption) (db *mongo.Database, terminate func(), err error)

func Redis

func Redis(ctx context.Context, opts ...RedisOption) (cli *redis.Client, terminate func(), err error)

Types

type ContainerNames

type ContainerNames struct {
	Mongo     string
	Redis     string
	Kafka     string
	Zookeeper string
	Network   string
}

type KafkaBroker

type KafkaBroker struct {
	Addr    []string
	Version string
}

func Kafka

func Kafka(ctx context.Context, opts ...KafkaOption) (broker KafkaBroker, terminate func(), err error)

type KafkaOption

type KafkaOption func(options *kafkaOptions)

func KafkaContainerName

func KafkaContainerName(name string) KafkaOption

func KafkaContainerNetwork

func KafkaContainerNetwork(networks []string) KafkaOption

func KafkaEnableLogger

func KafkaEnableLogger() KafkaOption

func KafkaImageTag

func KafkaImageTag(tag string) KafkaOption

func ZookeeperContainerName

func ZookeeperContainerName(name string) KafkaOption

func ZookeeperImageTag

func ZookeeperImageTag(tag string) KafkaOption

type MongoOption

type MongoOption func(options *mongoOptions)

func MongoContainerBootstrapTimeout

func MongoContainerBootstrapTimeout(timeout time.Duration) MongoOption

func MongoContainerEnv

func MongoContainerEnv(envs map[string]string) MongoOption

func MongoContainerName

func MongoContainerName(name string) MongoOption

func MongoContainerNetwork

func MongoContainerNetwork(networks []string) MongoOption

func MongoContainerPort

func MongoContainerPort(port int) MongoOption

func MongoEnableLogger

func MongoEnableLogger() MongoOption

func MongoImageTag

func MongoImageTag(tag string) MongoOption

type RedisOption

type RedisOption func(*redisOptions)

func RedisContainerBootstrapTimeout

func RedisContainerBootstrapTimeout(timeout time.Duration) RedisOption

func RedisContainerEnv

func RedisContainerEnv(envs map[string]string) RedisOption

func RedisContainerName

func RedisContainerName(name string) RedisOption

func RedisContainerNetwork

func RedisContainerNetwork(networks []string) RedisOption

func RedisContainerPort

func RedisContainerPort(port int) RedisOption

func RedisEnableLogger

func RedisEnableLogger() RedisOption

func RedisImageTag

func RedisImageTag(tag string) RedisOption

func RedisServerOptions

func RedisServerOptions(serverOpts *redis.Options) RedisOption

type Sets

type Sets struct {
	ContainerNames ContainerNames
	// contains filtered or unexported fields
}

func NewSets

func NewSets() *Sets

func (*Sets) Clear

func (i *Sets) Clear()

func (*Sets) Close

func (i *Sets) Close()

func (*Sets) Err

func (i *Sets) Err() error

func (*Sets) KafkaAddr

func (i *Sets) KafkaAddr() []string

func (*Sets) KafkaVersion

func (i *Sets) KafkaVersion() string

func (*Sets) MongoDB

func (i *Sets) MongoDB() *mongo.Database

func (*Sets) RedisClient

func (i *Sets) RedisClient() *redis.Client

func (*Sets) RemoveNetwork

func (i *Sets) RemoveNetwork(ctx context.Context) error

func (*Sets) SetupBridgeNetwork

func (i *Sets) SetupBridgeNetwork(ctx context.Context)

func (*Sets) SetupKafka

func (i *Sets) SetupKafka(ctx context.Context)

func (*Sets) SetupMongo

func (i *Sets) SetupMongo(ctx context.Context)

func (*Sets) SetupRedis

func (i *Sets) SetupRedis(ctx context.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL