feat(platform): expose source slots in vehicle service
This commit is contained in:
@@ -96,6 +96,7 @@ func TestHandlerVehicleCoverage(t *testing.T) {
|
||||
Data Page[struct {
|
||||
VIN string `json:"vin"`
|
||||
MissingProtocols []string `json:"missingProtocols"`
|
||||
SourceStatus []VehicleSourceStatus `json:"sourceStatus"`
|
||||
SourceConsistency *VehicleSourceConsistency `json:"sourceConsistency"`
|
||||
}] `json:"data"`
|
||||
}
|
||||
@@ -111,6 +112,18 @@ func TestHandlerVehicleCoverage(t *testing.T) {
|
||||
if rawBody.Data.Items[0].SourceConsistency.Status != "degraded" || !containsString(rawBody.Data.Items[0].SourceConsistency.MissingProtocols, "YUTONG_MQTT") {
|
||||
t.Fatalf("coverage source consistency should diagnose missing source evidence, got %+v body=%s", rawBody.Data.Items[0].SourceConsistency, rec.Body.String())
|
||||
}
|
||||
byProtocol := map[string]VehicleSourceStatus{}
|
||||
for _, source := range rawBody.Data.Items[0].SourceStatus {
|
||||
byProtocol[source.Protocol] = source
|
||||
}
|
||||
for _, protocol := range []string{"GB32960", "JT808", "YUTONG_MQTT"} {
|
||||
if _, ok := byProtocol[protocol]; !ok {
|
||||
t.Fatalf("coverage row should expose canonical source slot %s, got %+v body=%s", protocol, rawBody.Data.Items[0].SourceStatus, rec.Body.String())
|
||||
}
|
||||
}
|
||||
if !byProtocol["JT808"].Online || byProtocol["YUTONG_MQTT"].Online || byProtocol["YUTONG_MQTT"].HasRealtime {
|
||||
t.Fatalf("coverage source slots should expose online and missing evidence, got %+v", byProtocol)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehicleCoverageFiltersServiceStatus(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user