fix(platform): count source online by protocol
This commit is contained in:
@@ -64,3 +64,22 @@ func TestVehicleServiceOverviewsUsesBatchDataPath(t *testing.T) {
|
||||
t.Fatalf("batch overview should avoid per-keyword store calls, vehicles=%d realtime=%d", store.vehiclesCalls, store.vehicleRealtimeCalls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVehicleServiceSummaryCountsProtocolOnlineByProtocolSlot(t *testing.T) {
|
||||
service := NewService(NewMockStore())
|
||||
summary, err := service.VehicleServiceSummary(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("VehicleServiceSummary returned error: %v", err)
|
||||
}
|
||||
byProtocol := map[string]ProtocolStat{}
|
||||
for _, protocol := range summary.Protocols {
|
||||
byProtocol[protocol.Protocol] = protocol
|
||||
}
|
||||
gb32960 := byProtocol["GB32960"]
|
||||
if gb32960.Total != 2 {
|
||||
t.Fatalf("expected two GB32960 source slots, got %+v", gb32960)
|
||||
}
|
||||
if gb32960.Online != 1 {
|
||||
t.Fatalf("GB32960 online count must use GB32960 source status only, got %+v", gb32960)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user