test(api): 等待异步任务完成后校验结果
ci / verify (pull_request) Successful in 12m38s

真实队列环境中 X-Async 请求会先返回 queued。集成测试改为轮询任务完成并重新读取详情,避免把正确的异步受理状态误判为失败。
This commit is contained in:
2026-07-22 08:56:30 +08:00
parent eb37b568ae
commit a23b28c27d
3 changed files with 20 additions and 0 deletions
@@ -145,6 +145,11 @@ WHERE username = $1`, username); err != nil {
http.StatusAccepted,
&response,
)
if response.Task.ID == "" {
t.Fatal("async Kling simulation response did not return a task id")
}
waitForTaskStatus(t, server.URL, apiKeyResponse.Secret, response.Task.ID, []string{"succeeded"}, 10*time.Second)
doJSON(t, server.URL, http.MethodGet, "/api/v1/tasks/"+response.Task.ID, apiKeyResponse.Secret, nil, http.StatusOK, &response.Task)
task := response.Task
if task.ID == "" ||