Documentation
¶
Index ¶
- type TestHelper
- func (h *TestHelper) AssertEqual(expected, actual interface{}, message string)
- func (h *TestHelper) AssertError(err error, message string)
- func (h *TestHelper) AssertNoError(err error, message string)
- func (h *TestHelper) AssertNotEmpty(obj interface{}, message string)
- func (h *TestHelper) AssertNotNil(obj interface{}, message string)
- func (h *TestHelper) AssertTrue(condition bool, message string)
- func (h *TestHelper) Cleanup()
- func (h *TestHelper) CleanupKafkaTopics(topics []string)
- func (h *TestHelper) CleanupNATSStreams(streamPrefix string)
- func (h *TestHelper) CloseEventBus(bus eventbus.EventBus)
- func (h *TestHelper) CreateKafkaEventBus(clientID string) eventbus.EventBus
- func (h *TestHelper) CreateKafkaEventBusWithHealthCheck(groupID string, healthCheckConfig config.HealthCheckConfig) eventbus.EventBus
- func (h *TestHelper) CreateKafkaTopics(topics []string, numPartitions int32)
- func (h *TestHelper) CreateMemoryEventBus() eventbus.EventBus
- func (h *TestHelper) CreateNATSEventBus(clientID string) eventbus.EventBus
- func (h *TestHelper) CreateNATSEventBusWithHealthCheck(clientID string, healthCheckConfig config.HealthCheckConfig) eventbus.EventBus
- func (h *TestHelper) GetTimestamp() int64
- func (h *TestHelper) WaitForCondition(condition func() bool, timeout time.Duration, message string) bool
- func (h *TestHelper) WaitForMessages(received *int64, expected int64, timeout time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestHelper ¶
type TestHelper struct {
// contains filtered or unexported fields
}
TestHelper 测试辅助工具
func (*TestHelper) AssertEqual ¶
func (h *TestHelper) AssertEqual(expected, actual interface{}, message string)
AssertEqual 断言相等
func (*TestHelper) AssertError ¶ added in v1.1.23
func (h *TestHelper) AssertError(err error, message string)
AssertError 断言有错误
func (*TestHelper) AssertNoError ¶
func (h *TestHelper) AssertNoError(err error, message string)
AssertNoError 断言无错误
func (*TestHelper) AssertNotEmpty ¶ added in v1.1.23
func (h *TestHelper) AssertNotEmpty(obj interface{}, message string)
AssertNotEmpty 断言非空
func (*TestHelper) AssertNotNil ¶ added in v1.1.23
func (h *TestHelper) AssertNotNil(obj interface{}, message string)
AssertNotNil 断言不为 nil
func (*TestHelper) AssertTrue ¶
func (h *TestHelper) AssertTrue(condition bool, message string)
AssertTrue 断言为真
func (*TestHelper) CleanupKafkaTopics ¶
func (h *TestHelper) CleanupKafkaTopics(topics []string)
CleanupKafkaTopics 清理 Kafka topics
func (*TestHelper) CleanupNATSStreams ¶
func (h *TestHelper) CleanupNATSStreams(streamPrefix string)
CleanupNATSStreams 清理 NATS streams
func (*TestHelper) CloseEventBus ¶
func (h *TestHelper) CloseEventBus(bus eventbus.EventBus)
CloseEventBus 关闭 EventBus 并等待资源释放
func (*TestHelper) CreateKafkaEventBus ¶
func (h *TestHelper) CreateKafkaEventBus(clientID string) eventbus.EventBus
CreateKafkaEventBus 创建 Kafka EventBus 用于测试
func (*TestHelper) CreateKafkaEventBusWithHealthCheck ¶
func (h *TestHelper) CreateKafkaEventBusWithHealthCheck(groupID string, healthCheckConfig config.HealthCheckConfig) eventbus.EventBus
CreateKafkaEventBusWithHealthCheck 创建带自定义健康检查配置的 Kafka EventBus 用于测试
func (*TestHelper) CreateKafkaTopics ¶
func (h *TestHelper) CreateKafkaTopics(topics []string, numPartitions int32)
CreateKafkaTopics 创建 Kafka topics
func (*TestHelper) CreateMemoryEventBus ¶
func (h *TestHelper) CreateMemoryEventBus() eventbus.EventBus
CreateMemoryEventBus 创建 Memory EventBus 用于测试
func (*TestHelper) CreateNATSEventBus ¶
func (h *TestHelper) CreateNATSEventBus(clientID string) eventbus.EventBus
CreateNATSEventBus 创建 NATS EventBus 用于测试 注意:启用 JetStream 以支持持久化功能测试
func (*TestHelper) CreateNATSEventBusWithHealthCheck ¶
func (h *TestHelper) CreateNATSEventBusWithHealthCheck(clientID string, healthCheckConfig config.HealthCheckConfig) eventbus.EventBus
CreateNATSEventBusWithHealthCheck 创建带自定义健康检查配置的 NATS EventBus 用于测试
func (*TestHelper) GetTimestamp ¶
func (h *TestHelper) GetTimestamp() int64
GetTimestamp 获取当前时间戳(用于生成唯一ID)
func (*TestHelper) WaitForCondition ¶
func (h *TestHelper) WaitForCondition(condition func() bool, timeout time.Duration, message string) bool
WaitForCondition 等待条件满足
func (*TestHelper) WaitForMessages ¶
WaitForMessages 等待接收指定数量的消息