refactor(go): default to go vehicle topics
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/history"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/metrics"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/observability"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/topics"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -143,7 +144,7 @@ type config struct {
|
||||
func loadConfig() config {
|
||||
return config{
|
||||
KafkaBrokers: splitCSV(env("KAFKA_BROKERS", "127.0.0.1:9092")),
|
||||
KafkaTopics: splitCSV(env("KAFKA_TOPICS", "vehicle.raw.gb32960.v1,vehicle.raw.jt808.v1,vehicle.raw.yutong-mqtt.v1")),
|
||||
KafkaTopics: splitCSV(env("KAFKA_TOPICS", strings.Join([]string{topics.RawGB32960, topics.RawJT808, topics.RawYutongMQTT}, ","))),
|
||||
KafkaGroup: env("KAFKA_GROUP", "go-history-writer"),
|
||||
TDengineDriver: env("TDENGINE_DRIVER", "taosWS"),
|
||||
TDengineDSN: env("TDENGINE_DSN", ""),
|
||||
|
||||
@@ -74,6 +74,16 @@ func TestProcessHistoryMessageRecordsMetrics(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadConfigDefaultsToGoRawTopics(t *testing.T) {
|
||||
cfg := loadConfig()
|
||||
|
||||
got := strings.Join(cfg.KafkaTopics, ",")
|
||||
want := "vehicle.raw.go.gb32960.v1,vehicle.raw.go.jt808.v1,vehicle.raw.go.yutong-mqtt.v1"
|
||||
if got != want {
|
||||
t.Fatalf("KafkaTopics = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
type contextCheckingHistoryAppender struct {
|
||||
ctxErr error
|
||||
count int
|
||||
|
||||
Reference in New Issue
Block a user