feat(platform): add source readiness operations view
This commit is contained in:
@@ -939,6 +939,44 @@ func TestHandlerOpsHealthIncludesVehicleServiceRuntime(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerSourceReadiness(t *testing.T) {
|
||||
handler := NewHandler(NewServiceWithRuntime(NewMockStore(), RuntimeInfo{PlatformRelease: "platform-source-test"}))
|
||||
rec := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodGet, "/api/ops/source-readiness", nil)
|
||||
handler.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var body struct {
|
||||
Data SourceReadinessPlan `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
|
||||
t.Fatalf("response JSON should decode source readiness: %v body=%s", err, rec.Body.String())
|
||||
}
|
||||
if body.Data.PlatformRelease != "platform-source-test" {
|
||||
t.Fatalf("source readiness should expose runtime release, got %+v", body.Data)
|
||||
}
|
||||
if len(body.Data.Sources) < len(canonicalVehicleProtocols) {
|
||||
t.Fatalf("source readiness should expose canonical protocol slots, got %+v", body.Data.Sources)
|
||||
}
|
||||
byProtocol := map[string]SourceReadinessRow{}
|
||||
for _, source := range body.Data.Sources {
|
||||
byProtocol[source.Protocol] = source
|
||||
}
|
||||
for _, protocol := range canonicalVehicleProtocols {
|
||||
row, ok := byProtocol[protocol]
|
||||
if !ok {
|
||||
t.Fatalf("source readiness missing protocol %s: %+v", protocol, body.Data.Sources)
|
||||
}
|
||||
if row.Role == "" || row.Evidence == "" || row.Action == "" || row.Acceptance == "" {
|
||||
t.Fatalf("source readiness row should be operationally actionable: %+v", row)
|
||||
}
|
||||
if !strings.Contains(row.VehiclesHash, "missingProtocol="+protocol) || !strings.Contains(row.RealtimeHash, "protocol="+protocol) {
|
||||
t.Fatalf("source readiness should include workflow hashes, got %+v", row)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerVehicleDataAPIsResolveVehicleKeyword(t *testing.T) {
|
||||
handler := NewHandler(NewService(NewMockStore()))
|
||||
cases := []struct {
|
||||
|
||||
Reference in New Issue
Block a user