30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestLoadLocalKeepsRocketMQDisabled(t *testing.T) {
|
|
cfg, err := Load("../../configs/config.yaml")
|
|
if err != nil {
|
|
t.Fatalf("Load local config failed: %v", err)
|
|
}
|
|
if cfg.RocketMQ.Enabled || cfg.RocketMQ.WalletOutbox.Enabled || cfg.RocketMQ.RoomOutbox.Enabled {
|
|
t.Fatalf("local config must not require RocketMQ: %+v", cfg.RocketMQ)
|
|
}
|
|
}
|
|
|
|
func TestLoadTencentExampleEnablesOutboxMQConsumers(t *testing.T) {
|
|
cfg, err := Load("../../configs/config.tencent.example.yaml")
|
|
if err != nil {
|
|
t.Fatalf("Load tencent example failed: %v", err)
|
|
}
|
|
if cfg.WalletNoticeWorker.Enabled || cfg.RoomNoticeWorker.Enabled {
|
|
t.Fatalf("tencent example must keep legacy DB poll workers disabled: wallet=%+v room=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker)
|
|
}
|
|
if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || cfg.RocketMQ.WalletOutbox.Topic == "" || cfg.RocketMQ.WalletOutbox.ConsumerGroup == "" {
|
|
t.Fatalf("tencent example must configure wallet outbox MQ consumer: %+v", cfg.RocketMQ)
|
|
}
|
|
if !cfg.RocketMQ.RoomOutbox.Enabled || cfg.RocketMQ.RoomOutbox.Topic == "" || cfg.RocketMQ.RoomOutbox.ConsumerGroup == "" {
|
|
t.Fatalf("tencent example must configure room outbox MQ consumer: %+v", cfg.RocketMQ)
|
|
}
|
|
}
|