2026-06-09 12:00:45 +08:00

35 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package config
import "testing"
func TestLoadLocalEnablesOutboxMQConsumers(t *testing.T) {
cfg, err := Load("../../configs/config.yaml")
if err != nil {
t.Fatalf("Load local config failed: %v", err)
}
// 本地默认也走 MQ fanout避免本地、testbox、线上三套 outbox 语义漂移。
if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || !cfg.RocketMQ.RoomOutbox.Enabled || !cfg.RocketMQ.UserOutbox.Enabled {
t.Fatalf("local config must enable all notice outbox MQ consumers: %+v", cfg.RocketMQ)
}
// 直扫 owner DB 的老 worker 已被启动校验禁用,只保留配置参数给离线修复工具复用。
if cfg.WalletNoticeWorker.Enabled || cfg.RoomNoticeWorker.Enabled || cfg.CPNoticeWorker.Enabled {
t.Fatalf("local config must keep legacy DB poll workers disabled: wallet=%+v room=%+v cp=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker, cfg.CPNoticeWorker)
}
}
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 || cfg.CPNoticeWorker.Enabled {
t.Fatalf("tencent example must keep legacy DB poll workers disabled: wallet=%+v room=%+v cp=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker, cfg.CPNoticeWorker)
}
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)
}
}