feat(platform): expose amap runtime health

This commit is contained in:
lingniu
2026-07-04 15:30:51 +08:00
parent 5bbd110743
commit 1f069178d6
6 changed files with 64 additions and 10 deletions

View File

@@ -889,7 +889,13 @@ func TestHandlerQualityNotificationPlan(t *testing.T) {
}
func TestHandlerOpsHealthIncludesVehicleServiceRuntime(t *testing.T) {
handler := NewHandler(NewServiceWithRuntime(NewMockStore(), RuntimeInfo{RequestTimeoutMs: 1500}))
handler := NewHandler(NewServiceWithRuntime(NewMockStore(), RuntimeInfo{
RequestTimeoutMs: 1500,
AMapWebJSConfigured: true,
AMapSecurityProxyEnabled: true,
AMapSecurityCodeExposed: false,
AMapSecurityServiceHost: "/_AMapService",
}))
rec := httptest.NewRecorder()
req := httptest.NewRequest(http.MethodGet, "/api/ops/health", nil)
handler.ServeHTTP(rec, req)
@@ -905,6 +911,15 @@ func TestHandlerOpsHealthIncludesVehicleServiceRuntime(t *testing.T) {
if body.Data.Runtime.RequestTimeoutMs != 1500 {
t.Fatalf("ops health should include request timeout runtime, got %+v body=%s", body.Data.Runtime, rec.Body.String())
}
if !body.Data.Runtime.AMapWebJSConfigured || !body.Data.Runtime.AMapSecurityProxyEnabled {
t.Fatalf("ops health should expose AMap runtime readiness, got %+v body=%s", body.Data.Runtime, rec.Body.String())
}
if body.Data.Runtime.AMapSecurityCodeExposed {
t.Fatalf("ops health should show that AMap security code is not exposed when proxy is enabled: %+v", body.Data.Runtime)
}
if body.Data.Runtime.AMapSecurityServiceHost != "/_AMapService" {
t.Fatalf("ops health should include AMap security service host, got %+v", body.Data.Runtime)
}
}
func TestHandlerVehicleDataAPIsResolveVehicleKeyword(t *testing.T) {