Make the rewind happy test tolerant of the settle-release window
ci / vet-and-test (pull_request) Successful in 41s
ci / vet-and-test (pull_request) Successful in 41s
Why: run terminal status persists before the conversation claim is released; on the slow CI runner the rewind POST landed inside that window and got a 409. Retry the POST until the claim frees (bounded). Evidence: go test -count=5 ./internal/server/ -run TestRewindFilesHTTPHappy green; full suite green. Impact: test-only. Refs: Agent-System-Backend#94 #97
This commit is contained in:
@@ -86,7 +86,21 @@ func TestRewindFilesHTTPHappy(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
code, out := doJSON(t, h, "POST", "/api/conversations/"+convID+"/rewind", map[string]any{"messageId": userMsgID})
|
||||
// run 行已终态与释放会话占用之间有个 settle 窗口(CI 慢机上会撞 409):
|
||||
// 有界重试直到放行。
|
||||
var code int
|
||||
var out map[string]any
|
||||
deadline2 := time.Now().Add(3 * time.Second)
|
||||
for {
|
||||
code, out = doJSON(t, h, "POST", "/api/conversations/"+convID+"/rewind", map[string]any{"messageId": userMsgID})
|
||||
if code != http.StatusConflict {
|
||||
break
|
||||
}
|
||||
if time.Now().After(deadline2) {
|
||||
break
|
||||
}
|
||||
time.Sleep(15 * time.Millisecond)
|
||||
}
|
||||
if code != http.StatusOK {
|
||||
t.Fatalf("rewind status %d: %v", code, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user