Documentation
¶
Index ¶
- func NewContext(t *testing.T, timeout time.Duration) (context.Context, context.CancelFunc)
- func NewEtcdContainerClient(t *testing.T) *clientv3.Client
- func NewEtcdContainerConfig(t *testing.T) *connector.EtcdConfig
- func NewEtcdContainerConnector(t *testing.T) connector.EtcdConnector
- func NewID() string
- func NewKafkaContainerClient(t *testing.T) *kgo.Client
- func NewKafkaContainerConfig(t *testing.T) *connector.KafkaConfig
- func NewKafkaContainerConnector(t *testing.T) connector.KafkaConnector
- func NewLogger() clog.Logger
- func NewMeter() metrics.Meter
- func NewMySQLConnector(t *testing.T) connector.MySQLConnector
- func NewMySQLContainerConfig(t *testing.T) *connector.MySQLConfig
- func NewMySQLDB(t *testing.T) *gorm.DB
- func NewNATSContainerConfig(t *testing.T) *connector.NATSConfig
- func NewNATSContainerConn(t *testing.T) *nats.Conn
- func NewNATSContainerConnector(t *testing.T) connector.NATSConnector
- func NewPersistentSQLiteConfig(t *testing.T) *connector.SQLiteConfig
- func NewPersistentSQLiteConnector(t *testing.T) connector.SQLiteConnector
- func NewPostgreSQLConnector(t *testing.T) connector.PostgreSQLConnector
- func NewPostgreSQLContainerConfig(t *testing.T) *connector.PostgreSQLConfig
- func NewPostgreSQLDB(t *testing.T) *gorm.DB
- func NewRedisContainerClient(t *testing.T) *redis.Client
- func NewRedisContainerConfig(t *testing.T) *connector.RedisConfig
- func NewRedisContainerConnector(t *testing.T) connector.RedisConnector
- func NewSQLiteConfig() *connector.SQLiteConfig
- func NewSQLiteConnector(t *testing.T) connector.SQLiteConnector
- func NewSQLiteDB(t *testing.T) *gorm.DB
- type Kit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext 返回一个带有超时的测试上下文
func NewEtcdContainerClient ¶
NewEtcdContainerClient 使用 testcontainers 创建并返回原生 Etcd 客户端 生命周期由 t.Cleanup 管理
func NewEtcdContainerConfig ¶
func NewEtcdContainerConfig(t *testing.T) *connector.EtcdConfig
NewEtcdContainerConfig 使用 testcontainers 创建 Etcd 容器并返回配置 生命周期由 t.Cleanup 管理
func NewEtcdContainerConnector ¶
func NewEtcdContainerConnector(t *testing.T) connector.EtcdConnector
NewEtcdContainerConnector 使用 testcontainers 创建并连接 Etcd 连接器 生命周期由 t.Cleanup 管理
func NewID ¶
func NewID() string
NewID 返回一个唯一的测试 ID (UUID v4 前 8 位) 用于生成唯一的 Key、Topic 或表名后缀,避免测试间数据冲突
func NewKafkaContainerClient ¶
NewKafkaContainerClient 使用 testcontainers 创建并返回原生 Kafka 客户端 生命周期由 t.Cleanup 管理
func NewKafkaContainerConfig ¶
func NewKafkaContainerConfig(t *testing.T) *connector.KafkaConfig
NewKafkaContainerConfig 使用 testcontainers 创建 Kafka 容器并返回配置 生命周期由 t.Cleanup 管理
func NewKafkaContainerConnector ¶
func NewKafkaContainerConnector(t *testing.T) connector.KafkaConnector
NewKafkaContainerConnector 使用 testcontainers 创建并连接 Kafka 连接器 生命周期由 t.Cleanup 管理
func NewMySQLConnector ¶
func NewMySQLConnector(t *testing.T) connector.MySQLConnector
NewMySQLConnector 获取 MySQL 连接器(基于 testcontainers) 生命周期由 t.Cleanup 管理
func NewMySQLContainerConfig ¶
func NewMySQLContainerConfig(t *testing.T) *connector.MySQLConfig
NewMySQLContainerConfig 使用 testcontainers 创建 MySQL 容器并返回配置 生命周期由 t.Cleanup 管理
func NewMySQLDB ¶
NewMySQLDB 获取 GORM DB 实例(基于 testcontainers)
func NewNATSContainerConfig ¶
func NewNATSContainerConfig(t *testing.T) *connector.NATSConfig
NewNATSContainerConfig 使用 testcontainers 创建 NATS 容器并返回配置 生命周期由 t.Cleanup 管理
func NewNATSContainerConn ¶
NewNATSContainerConn 使用 testcontainers 创建并返回原生 NATS 连接 生命周期由 t.Cleanup 管理
func NewNATSContainerConnector ¶
func NewNATSContainerConnector(t *testing.T) connector.NATSConnector
NewNATSContainerConnector 使用 testcontainers 创建并连接 NATS 连接器 生命周期由 t.Cleanup 管理
func NewPersistentSQLiteConfig ¶
func NewPersistentSQLiteConfig(t *testing.T) *connector.SQLiteConfig
NewPersistentSQLiteConfig 返回持久化 SQLite 测试配置 用于需要文件持久化的测试场景,数据库文件存储在 t.TempDir() 中
func NewPersistentSQLiteConnector ¶
func NewPersistentSQLiteConnector(t *testing.T) connector.SQLiteConnector
NewPersistentSQLiteConnector 获取持久化 SQLite 连接器 数据库文件存储在临时目录中,测试结束后自动清理 生命周期由 t.Cleanup 管理
func NewPostgreSQLConnector ¶
func NewPostgreSQLConnector(t *testing.T) connector.PostgreSQLConnector
NewPostgreSQLConnector 获取 PostgreSQL 连接器(基于 testcontainers) 生命周期由 t.Cleanup 管理
func NewPostgreSQLContainerConfig ¶
func NewPostgreSQLContainerConfig(t *testing.T) *connector.PostgreSQLConfig
NewPostgreSQLContainerConfig 使用 testcontainers 创建 PostgreSQL 容器并返回配置 生命周期由 t.Cleanup 管理
func NewPostgreSQLDB ¶
NewPostgreSQLDB 获取 GORM DB 实例(基于 testcontainers)
func NewRedisContainerClient ¶
NewRedisContainerClient 使用 testcontainers 创建并返回原生 Redis 客户端 生命周期由 t.Cleanup 管理
func NewRedisContainerConfig ¶
func NewRedisContainerConfig(t *testing.T) *connector.RedisConfig
NewRedisContainerConfig 使用 testcontainers 创建 Redis 容器并返回配置 生命周期由 t.Cleanup 管理
func NewRedisContainerConnector ¶
func NewRedisContainerConnector(t *testing.T) connector.RedisConnector
NewRedisContainerConnector 使用 testcontainers 创建并连接 Redis 连接器 生命周期由 t.Cleanup 管理
func NewSQLiteConfig ¶
func NewSQLiteConfig() *connector.SQLiteConfig
NewSQLiteContainerConfig 返回 SQLite 内存数据库配置 默认使用内存数据库,测试结束后自动清理
func NewSQLiteConnector ¶
func NewSQLiteConnector(t *testing.T) connector.SQLiteConnector
NewSQLiteConnector 获取 SQLite 连接器(内存数据库) 生命周期由 t.Cleanup 管理