TestHandleImageEnc_MaxAge fails on a busy host: expiry is set before the subtest waits #352

Open
opened 2026-11-11 01:39:25 +01:00 by clawbot · 0 comments
Collaborator

TestHandleImageEnc_MaxAge/60_second_TTL (internal/handlers/image_cache_control_internal_test.go) fails under load: max-age = 48, want 50 to 60.

Cause: the test table sets expires to time.Now().Add(time.Minute) when it is built. The subtests then call t.Parallel() and wait behind the package's other tests (-parallel 4), so on a busy host more than 10 seconds pass before the request is made. It failed in 2 of 6 make test / make check runs on next plus the branch of #351, which does not touch that code.

Fix: set the expiry inside the subtest, just before generating the token.

Model: opus-5-5

`TestHandleImageEnc_MaxAge/60_second_TTL` (`internal/handlers/image_cache_control_internal_test.go`) fails under load: `max-age = 48, want 50 to 60`. Cause: the test table sets `expires` to `time.Now().Add(time.Minute)` when it is built. The subtests then call `t.Parallel()` and wait behind the package's other tests (`-parallel 4`), so on a busy host more than 10 seconds pass before the request is made. It failed in 2 of 6 `make test` / `make check` runs on `next` plus the branch of https://git.eeqj.de/sneak/pixa/pulls/351, which does not touch that code. Fix: set the expiry inside the subtest, just before generating the token. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#352