Documentation
¶
Index ¶
- type EventCollector
- func (ec *EventCollector) AddDeadLetterEvent(event interface{})
- func (ec *EventCollector) AddInitializedEvent(event interface{})
- func (ec *EventCollector) AddRestartEvent(event interface{})
- func (ec *EventCollector) AddStartedEvent(event interface{})
- func (ec *EventCollector) AddStoppedEvent(event interface{})
- func (ec *EventCollector) GetDeadLetterCount() int
- func (ec *EventCollector) GetInitializedCount() int
- func (ec *EventCollector) GetRestartCount() int
- func (ec *EventCollector) GetStartedCount() int
- func (ec *EventCollector) GetStoppedCount() int
- func (ec *EventCollector) Reset()
- type TestHelper
- func (h *TestHelper) AddCleanup(fn func())
- func (h *TestHelper) AssertEqual(expected, actual interface{}, message string)
- func (h *TestHelper) AssertError(err error, message string)
- func (h *TestHelper) AssertGreaterThan(actual, threshold int64, message string)
- func (h *TestHelper) AssertGreaterThanOrEqual(actual, threshold int64, message string)
- func (h *TestHelper) AssertLessThan(actual, threshold int64, message string)
- func (h *TestHelper) AssertNoError(err error, message string)
- func (h *TestHelper) AssertTrue(condition bool, message string)
- func (h *TestHelper) Cleanup()
- func (h *TestHelper) CloseEventBus(bus eventbus.EventBus)
- func (h *TestHelper) CreateKafkaEventBus(clientID string) eventbus.EventBus
- func (h *TestHelper) CreateMemoryEventBus() eventbus.EventBus
- func (h *TestHelper) CreateNATSEventBus(clientID, streamName string, subjects []string, durableName string) eventbus.EventBus
- func (h *TestHelper) GetTimestamp() int64
- func (h *TestHelper) Logf(format string, args ...interface{})
- func (h *TestHelper) Sleep(duration time.Duration)
- 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 EventCollector ¶
type EventCollector struct {
// contains filtered or unexported fields
}
EventCollector 事件收集器
func (*EventCollector) AddDeadLetterEvent ¶
func (ec *EventCollector) AddDeadLetterEvent(event interface{})
AddDeadLetterEvent 添加 DeadLetter 事件
func (*EventCollector) AddInitializedEvent ¶
func (ec *EventCollector) AddInitializedEvent(event interface{})
AddInitializedEvent 添加初始化事件
func (*EventCollector) AddRestartEvent ¶
func (ec *EventCollector) AddRestartEvent(event interface{})
AddRestartEvent 添加重启事件
func (*EventCollector) AddStartedEvent ¶
func (ec *EventCollector) AddStartedEvent(event interface{})
AddStartedEvent 添加启动事件
func (*EventCollector) AddStoppedEvent ¶
func (ec *EventCollector) AddStoppedEvent(event interface{})
AddStoppedEvent 添加停止事件
func (*EventCollector) GetDeadLetterCount ¶
func (ec *EventCollector) GetDeadLetterCount() int
GetDeadLetterCount 获取 DeadLetter 次数
func (*EventCollector) GetInitializedCount ¶
func (ec *EventCollector) GetInitializedCount() int
GetInitializedCount 获取初始化次数
func (*EventCollector) GetRestartCount ¶
func (ec *EventCollector) GetRestartCount() int
GetRestartCount 获取重启次数
func (*EventCollector) GetStartedCount ¶
func (ec *EventCollector) GetStartedCount() int
GetStartedCount 获取启动次数
func (*EventCollector) GetStoppedCount ¶
func (ec *EventCollector) GetStoppedCount() int
GetStoppedCount 获取停止次数
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 ¶
func (h *TestHelper) AssertError(err error, message string)
AssertError 断言有错误
func (*TestHelper) AssertGreaterThan ¶
func (h *TestHelper) AssertGreaterThan(actual, threshold int64, message string)
AssertGreaterThan 断言大于
func (*TestHelper) AssertGreaterThanOrEqual ¶
func (h *TestHelper) AssertGreaterThanOrEqual(actual, threshold int64, message string)
AssertGreaterThanOrEqual 断言大于等于
func (*TestHelper) AssertLessThan ¶
func (h *TestHelper) AssertLessThan(actual, threshold int64, message string)
AssertLessThan 断言小于
func (*TestHelper) AssertNoError ¶
func (h *TestHelper) AssertNoError(err error, message string)
AssertNoError 断言无错误
func (*TestHelper) AssertTrue ¶
func (h *TestHelper) AssertTrue(condition bool, message string)
AssertTrue 断言为真
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) CreateMemoryEventBus ¶
func (h *TestHelper) CreateMemoryEventBus() eventbus.EventBus
CreateMemoryEventBus 创建 Memory EventBus
func (*TestHelper) CreateNATSEventBus ¶
func (h *TestHelper) CreateNATSEventBus(clientID, streamName string, subjects []string, durableName string) eventbus.EventBus
CreateNATSEventBus 创建 NATS JetStream EventBus,并在测试结束后清理 Stream
func (*TestHelper) WaitForCondition ¶
func (h *TestHelper) WaitForCondition(condition func() bool, timeout time.Duration, message string) bool
WaitForCondition 等待条件满足
func (*TestHelper) WaitForMessages ¶
WaitForMessages 等待消息数量达到预期