Documentation
¶
Index ¶
- type ContainerBuilder
- func (builder *ContainerBuilder) AddContainer(id string, containerInfo ContainerInfo)
- func (builder *ContainerBuilder) AllContainerIDs() []string
- func (builder *ContainerBuilder) FindContainer(containerName string) (*docker.APIContainers, error)
- func (builder *ContainerBuilder) GetContainerInfo(id string) (ContainerInfo, bool)
- func (builder *ContainerBuilder) PruneAll() error
- func (builder *ContainerBuilder) RemoveByID(containerID string) error
- type ContainerInfo
- type ContainerType
- type PostgresContainerOptions
- type PostgresContainerResult
- type RedisContainerOptions
- type RedisContainerResult
- type TestInstance
- func (ti *TestInstance) ClearRedisData() error
- func (ti *TestInstance) GetTestInfraProvider() (fx.Option, error)
- func (ti *TestInstance) PGCopyFromLargeJson() error
- func (ti *TestInstance) ResetAndRunSeedData() error
- func (ti *TestInstance) ResetDB() error
- func (ti *TestInstance) RunDBMigrations() error
- func (ti *TestInstance) TeardownInfra() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerBuilder ¶
type ContainerBuilder struct {
*dockertest.Pool
// contains filtered or unexported fields
}
func NewContainerBuilder ¶
func NewContainerBuilder(endpoint string) (*ContainerBuilder, error)
NewContainerBuilder creates a new ContainerBuilder instance. The endpoint parameter specifies the Docker endpoint to connect to. can be empty to use the default.
func (*ContainerBuilder) AddContainer ¶
func (builder *ContainerBuilder) AddContainer(id string, containerInfo ContainerInfo)
func (*ContainerBuilder) AllContainerIDs ¶
func (builder *ContainerBuilder) AllContainerIDs() []string
func (*ContainerBuilder) FindContainer ¶
func (builder *ContainerBuilder) FindContainer(containerName string) (*docker.APIContainers, error)
func (*ContainerBuilder) GetContainerInfo ¶
func (builder *ContainerBuilder) GetContainerInfo(id string) (ContainerInfo, bool)
func (*ContainerBuilder) PruneAll ¶
func (builder *ContainerBuilder) PruneAll() error
func (*ContainerBuilder) RemoveByID ¶
func (builder *ContainerBuilder) RemoveByID(containerID string) error
type ContainerInfo ¶
type ContainerInfo struct {
Name string
Type ContainerType
}
type ContainerType ¶
type ContainerType string
const (
ContainerTypeMongoDB ContainerType = "mongodb"
)
var (
PostgresContainer ContainerType = "postgres"
)
var (
RedisContainer ContainerType = "redis"
)
type PostgresContainerResult ¶
type PostgresContainerResult struct {
Name string
Host string
Port string
Username string
Password string
DatabaseName string
}
func BuildPostgresContainer ¶
func BuildPostgresContainer(builder *ContainerBuilder, options PostgresContainerOptions) (PostgresContainerResult, error)
type RedisContainerOptions ¶
type RedisContainerResult ¶
func BuildRedisContainer ¶
func BuildRedisContainer(builder *ContainerBuilder, options RedisContainerOptions) (RedisContainerResult, error)
BuildRedisContainer builds and starts a Redis container based on the provided options.
type TestInstance ¶
type TestInstance struct {
T *testing.T
Config infra.Config
SqlxDB *sqlx.DB
PgxConn *pgx.Conn
ImMemConsumerReader *mq.InMemoryConsumer
Redis redis.UniversalClient
MockProducer *mq.MockProducer
ContainerBuilder *ContainerBuilder
Ctx context.Context
}
func NewTestInstance ¶
func NewTestInstance(t *testing.T) (*TestInstance, error)
func (*TestInstance) ClearRedisData ¶
func (ti *TestInstance) ClearRedisData() error
func (*TestInstance) GetTestInfraProvider ¶
func (ti *TestInstance) GetTestInfraProvider() (fx.Option, error)
func (*TestInstance) PGCopyFromLargeJson ¶
func (ti *TestInstance) PGCopyFromLargeJson() error
func (*TestInstance) ResetAndRunSeedData ¶
func (ti *TestInstance) ResetAndRunSeedData() error
func (*TestInstance) ResetDB ¶
func (ti *TestInstance) ResetDB() error
func (*TestInstance) RunDBMigrations ¶
func (ti *TestInstance) RunDBMigrations() error
func (*TestInstance) TeardownInfra ¶
func (ti *TestInstance) TeardownInfra() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.