feat(platform): summarize missing vehicle sources

This commit is contained in:
lingniu
2026-07-04 05:38:17 +08:00
parent 6ac980adad
commit bc6715b35b
7 changed files with 150 additions and 0 deletions

View File

@@ -384,6 +384,24 @@ func TestHandlerVehicleServiceSummaryEndpoint(t *testing.T) {
if !noDataStatusFound {
t.Fatalf("summary service status distribution should include no_data, got %+v", body.Data.ServiceStatuses)
}
var rawBody struct {
Data struct {
MissingSources []struct {
Protocol string `json:"protocol"`
Count int `json:"count"`
} `json:"missingSources"`
} `json:"data"`
}
if err := json.Unmarshal(rec.Body.Bytes(), &rawBody); err != nil {
t.Fatalf("response JSON should decode raw summary: %v body=%s", err, rec.Body.String())
}
missing := map[string]int{}
for _, source := range rawBody.Data.MissingSources {
missing[source.Protocol] = source.Count
}
if missing["GB32960"] != 2 || missing["JT808"] != 2 || missing["YUTONG_MQTT"] != 3 {
t.Fatalf("summary should expose canonical missing source counts, got %+v body=%s", missing, rec.Body.String())
}
}
func TestHandlerVehicleServiceOverviewsEndpoint(t *testing.T) {