feat: complete remaining Go backend modules
This commit is contained in:
@@ -43,6 +43,44 @@ func TestHealthReportsProcessAndDatabaseConfigurationWithoutReadinessProbe(t *te
|
||||
}
|
||||
}
|
||||
|
||||
func TestHealthIncludesInjectedRuntimeCompatibilityDetails(t *testing.T) {
|
||||
details := httpapi.HealthDetails{
|
||||
VisualAPIMode: "volcengine",
|
||||
EvolinkMode: "mock",
|
||||
SeedanceMode: "seedance",
|
||||
BailianMode: "missing",
|
||||
AuthMode: "configured",
|
||||
Capabilities: []any{
|
||||
map[string]any{"id": "image.generate", "engine": "jimeng"},
|
||||
map[string]any{"id": "video.generate", "engine": "seedance"},
|
||||
},
|
||||
}
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
httpapi.NewHandler(&readinessStub{}, httpapi.WithHealthDetails(details)).ServeHTTP(
|
||||
recorder,
|
||||
httptest.NewRequest(http.MethodGet, "/api/health", nil),
|
||||
)
|
||||
|
||||
var response struct {
|
||||
VisualAPIMode string `json:"visualApiMode"`
|
||||
EvolinkMode string `json:"evolinkMode"`
|
||||
SeedanceMode string `json:"seedanceMode"`
|
||||
BailianMode string `json:"bailianMode"`
|
||||
AuthMode string `json:"authMode"`
|
||||
Capabilities []map[string]any `json:"capabilities"`
|
||||
}
|
||||
if err := json.NewDecoder(recorder.Body).Decode(&response); err != nil {
|
||||
t.Fatalf("decode response: %v", err)
|
||||
}
|
||||
if response.VisualAPIMode != "volcengine" || response.EvolinkMode != "mock" || response.SeedanceMode != "seedance" || response.BailianMode != "missing" || response.AuthMode != "configured" {
|
||||
t.Fatalf("runtime response = %+v", response)
|
||||
}
|
||||
if len(response.Capabilities) != 2 || response.Capabilities[0]["id"] != "image.generate" || response.Capabilities[1]["id"] != "video.generate" {
|
||||
t.Fatalf("capabilities = %#v", response.Capabilities)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadyReportsSuccessfulDatabaseProbe(t *testing.T) {
|
||||
readiness := &readinessStub{
|
||||
status: httpapi.DatabaseStatus{Backend: "postgres", Configured: true},
|
||||
|
||||
Reference in New Issue
Block a user