test: honor Retry-After in cold-start assign retry

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Chris Lu
2026-10-20 05:17:33 -07:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 4791d44d2c
commit 4fb5e5a154
+6 -1
View File
@@ -8,6 +8,7 @@ import (
"io"
"mime/multipart"
"net/http"
"strconv"
"testing"
"time"
@@ -44,7 +45,11 @@ func TestColdStartFirstWrite(t *testing.T) {
body, _ := io.ReadAll(resp.Body)
resp.Body.Close()
if resp.StatusCode == http.StatusServiceUnavailable && time.Now().Before(deadline) {
time.Sleep(time.Second)
delay, _ := strconv.Atoi(resp.Header.Get("Retry-After"))
if delay <= 0 {
t.Fatalf("dir/assign shed without a usable Retry-After: %d %s", resp.StatusCode, body)
}
time.Sleep(time.Duration(delay) * time.Second)
continue
}
if resp.StatusCode != http.StatusOK {