Commit 26d315c
authored
Use idiomatic httptest handler failures in labs installer tests (#5623)
Follow-up to a review comment on #5559.
`t.FailNow()` is documented as only legal on the goroutine running the
test. The labs installer tests call it from inside `httptest` handler
goroutines as the "unexpected request" fallback, where it only runs
`runtime.Goexit` on the handler goroutine: the test is not actually
failed and the client sees a dropped connection, which surfaces as a
confusing error rather than a clear message.
This replaces the four handler-goroutine occurrences with the idiomatic
shape — `t.Errorf(...)` to record the failure on the test, plus
`http.Error(w, "unexpected request", http.StatusInternalServerError)` to
return a clear response. The one remaining `t.FailNow()` is on the test
goroutine (a `t.Logf` / `t.FailNow` pair after the runner returns) and
is collapsed to `t.Fatal`.
Test-only change; no user-facing behavior changes.
This pull request and its description were written by Isaac, an AI
coding agent.1 parent fefe317 commit 26d315c
1 file changed
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
| 196 | + | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
| 265 | + | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
366 | | - | |
| 365 | + | |
| 366 | + | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
| 456 | + | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
| 499 | + | |
501 | 500 | | |
502 | 501 | | |
0 commit comments