refactor(go): default to go vehicle topics

This commit is contained in:
lingniu
2026-07-02 20:22:47 +08:00
parent 3248336bea
commit 2ae9794dda
15 changed files with 130 additions and 27 deletions

View File

@@ -113,6 +113,25 @@ func TestRecordNATSConsumerInfoMetrics(t *testing.T) {
}
}
func TestLoadConfigDefaultsToGoSubjectRoutes(t *testing.T) {
cfg := loadConfig()
want := map[string]string{
"vehicle.raw.go.gb32960.v1": "vehicle.raw.go.gb32960.v1",
"vehicle.raw.go.jt808.v1": "vehicle.raw.go.jt808.v1",
"vehicle.raw.go.yutong-mqtt.v1": "vehicle.raw.go.yutong-mqtt.v1",
"vehicle.event.go.unified.v1": "vehicle.event.go.unified.v1",
}
if len(cfg.Route) != len(want) {
t.Fatalf("route len = %d, want %d: %#v", len(cfg.Route), len(want), cfg.Route)
}
for subject, topic := range want {
if got := cfg.Route[subject]; got != topic {
t.Fatalf("route[%q] = %q, want %q; route=%#v", subject, got, topic, cfg.Route)
}
}
}
type recordingBridgeWriter struct {
messages []kafka.Message
err error