Shorter waits in the upload relay's webtests
Human
Prompt
Hub CI: internal/webtest took 10.7s, over the 10s budget.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
The busy, stalled-body, streaming and upstream-failure tests wait less (same assertions), taking about 1.6 s off the package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+6
−6
internal/webtest/ask_files_test.go+6 −6
diff --git a/internal/webtest/ask_files_test.go b/internal/webtest/ask_files_test.go| index bc675f8..fbacc9d 100644 |
| --- a/internal/webtest/ask_files_test.go |
| +++ b/internal/webtest/ask_files_test.go |
| @@ -216,7 +216,7 @@ func (a *testApp) uploadAll(n int) []int { |
| // A body that stalls loses its slot at the read deadline, through the |
| // whole router (Fable B3): afterwards four uploads at once all pass. |
| func TestAskUploadStalledBodyFreesItsSlot(t *testing.T) { |
| - bounds(t, web.UploadBounds{Slots: 4, SlotWait: 300 * time.Millisecond, ReadDeadline: 400 * time.Millisecond, Upstream: 5 * time.Second}) |
| + bounds(t, web.UploadBounds{Slots: 4, SlotWait: 60 * time.Millisecond, ReadDeadline: 150 * time.Millisecond, Upstream: 5 * time.Second}) |
| a, f := newAskApp(t) |
| a.connectEquipo(f) |
| u, _ := url.Parse(a.base) |
| @@ -234,7 +234,7 @@ func TestAskUploadStalledBodyFreesItsSlot(t *testing.T) { |
| if took := time.Since(start); took > 3*time.Second { |
| t.Fatalf("the stalled upload held on for %s (%v)", took, err) |
| } |
| - f.SlowUploads(200 * time.Millisecond) |
| + f.SlowUploads(120 * time.Millisecond) |
| for i, code := range a.uploadAll(4) { |
| if code != 201 { |
| t.Fatalf("upload %d after the stall: %d", i, code) |
| @@ -244,10 +244,10 @@ func TestAskUploadStalledBodyFreesItsSlot(t *testing.T) { |
| // Every slot busy: a fifth upload waits, then is told to come back. |
| func TestAskUploadBusy(t *testing.T) { |
| - bounds(t, web.UploadBounds{Slots: 4, SlotWait: 300 * time.Millisecond, ReadDeadline: 5 * time.Second, Upstream: 10 * time.Second}) |
| + bounds(t, web.UploadBounds{Slots: 4, SlotWait: 100 * time.Millisecond, ReadDeadline: 5 * time.Second, Upstream: 10 * time.Second}) |
| a, f := newAskApp(t) |
| a.connectEquipo(f) |
| - f.SlowUploads(1500 * time.Millisecond) |
| + f.SlowUploads(500 * time.Millisecond) |
| done := make(chan []int) |
| go func() { done <- a.uploadAll(4) }() |
| for i := 0; f.UploadsAtOnce() < 4; i++ { |
| @@ -399,7 +399,7 @@ func TestAskAttachmentStreams(t *testing.T) { |
| a.connectEquipo(f) |
| big := bytes.Repeat([]byte("0123456789abcdef"), 9<<20/16) |
| id := uploaded(t, a.upload("big.txt", "text/plain", big)) |
| - f.ServeSlowly(4 * time.Millisecond) // 144 pieces: about 0.6 s |
| + f.ServeSlowly(1500 * time.Microsecond) // 144 pieces: about 0.2 s |
| start := time.Now() |
| res, err := a.client.Get(a.base + "/ask/attachments/" + id) |
| if err != nil { |
| @@ -450,7 +450,7 @@ func TestAskAttachmentNotYours(t *testing.T) { |
| // Without a live link a file is 404, never a redirect; a refused bearer |
| // drops the link; Equipo failing or slow is 502 with nothing of Equipo's. |
| func TestAskAttachmentUpstreamFailures(t *testing.T) { |
| - bounds(t, web.UploadBounds{Slots: 4, SlotWait: time.Second, ReadDeadline: 5 * time.Second, Upstream: 300 * time.Millisecond}) |
| + bounds(t, web.UploadBounds{Slots: 4, SlotWait: time.Second, ReadDeadline: 5 * time.Second, Upstream: 150 * time.Millisecond}) |
| a, f := newAskApp(t) |
| if r := a.get("/ask/attachments/at_abcdefgh12"); r.Code != 404 { |
| t.Fatalf("not set up: %d %v", r.Code, r.Header) |