Documentation
¶
Index ¶
Constants ¶
const ( PostgresImage = "postgres:18-alpine" MySQLImage = "mysql:lts" RedisImage = "redis:8-alpine" MinIOImage = "minio/minio:latest" )
Container images.
const ( TestDatabaseName = "testdb" TestUsername = "testuser" TestPassword = "testpass" )
Database credentials.
const ( TestMinIOAccessKey = "testadmin" TestMinIOSecretKey = "testadmin" TestMinIOBucket = "testbucket" )
MinIO credentials.
const DefaultContainerTimeout = 30 * time.Second
DefaultContainerTimeout is the maximum wait time for container readiness.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBEnv ¶
type DBEnv struct {
T *testing.T
Ctx context.Context
RawDB *sql.DB
BunDB *bun.DB
DB orm.DB
DS *config.DataSourceConfig
}
DBEnv encapsulates the database environment for cross-database integration tests. Contains both the raw sql.DB connection and a wrapped orm.DB for convenience.
type DBSetupFunc ¶
DBSetupFunc creates a DataSourceConfig (spinning up a container if needed).
type MinIOContainer ¶
type MinIOContainer struct {
MinIO *config.MinIOConfig
// contains filtered or unexported fields
}
func NewMinIOContainer ¶
func NewMinIOContainer(ctx context.Context, t testing.TB) *MinIOContainer
type MySQLContainer ¶
type MySQLContainer struct {
DataSource *config.DataSourceConfig
// contains filtered or unexported fields
}
func NewMySQLContainer ¶
func NewMySQLContainer(ctx context.Context, t testing.TB) *MySQLContainer
type NamedFactory ¶
type NamedFactory[B any] struct { // contains filtered or unexported fields }
type PostgresContainer ¶
type PostgresContainer struct {
DataSource *config.DataSourceConfig
// contains filtered or unexported fields
}
func NewPostgresContainer ¶
func NewPostgresContainer(ctx context.Context, t testing.TB) *PostgresContainer
type RedisContainer ¶
type RedisContainer struct {
Redis *config.RedisConfig
// contains filtered or unexported fields
}
func NewRedisContainer ¶
func NewRedisContainer(ctx context.Context, t testing.TB) *RedisContainer
type SuiteFactory ¶
type SuiteFactory[B any] func(base *B) suite.TestingSuite
SuiteFactory creates a testify suite instance from a shared base configuration.
type SuiteRegistry ¶
type SuiteRegistry[B any] struct { // contains filtered or unexported fields }
SuiteRegistry holds suite factories and orchestrates their execution across databases.
func NewRegistry ¶
func NewRegistry[B any]() *SuiteRegistry[B]
NewRegistry creates a new empty suite registry.
func (*SuiteRegistry[B]) Add ¶
func (r *SuiteRegistry[B]) Add(factory SuiteFactory[B])
Add registers a suite factory. The test name is auto-extracted from the concrete suite type name, with "TestSuite" suffix stripped for cleaner test output.
func (*SuiteRegistry[B]) AddNamed ¶
func (r *SuiteRegistry[B]) AddNamed(name string, factory SuiteFactory[B])
AddNamed registers a suite factory with an explicit display name.
func (*SuiteRegistry[B]) Len ¶
func (r *SuiteRegistry[B]) Len() int
Len returns the number of registered suites.