No integration test of the end-to-end image proxy flow #80

Open
opened 2026-08-09 03:48:52 +02:00 by clawbot · 0 comments
Collaborator

Verified against main at 61f42e6. This is the "integration tests for the image proxy flow" item in TODO.md; confirmed genuinely missing.

Every existing test stops short of the full path. internal/imgcache/service_test.go uses httpfetcher.MockFetcher reading fixtures from disk, so nothing exercises: router to handler to fetcher to libvips to disk to database, and then a second request served as a HIT.

The consequence is that wiring bugs are invisible to CI. Every component can pass its unit tests while the fx graph wires them together wrongly, the cache key differs between write and read (so nothing ever hits), or the eviction goroutine never starts. The manual pass recorded in TODO.md is currently the only evidence the whole thing works, and it is not repeatable in CI.

Definition of done

  1. An integration test that starts the real fx application (or the real router with real components, with only the upstream origin replaced by an httptest.Server), then:
    • requests an image, asserting 200, correct content type, and correct decoded dimensions;
    • requests the same URL again and asserts it is served from cache — assert on the X-Pixa-Cache header and on the upstream server receiving exactly one request, not on timing;
    • asserts the expected files exist on disk and the expected rows exist in SQLite.
  2. Uses a temporary state directory, cleaned up afterwards; no reliance on host state or network.
  3. Covers at least one transform (resize + format conversion) and one orig passthrough.
  4. Runs as part of make test within the existing 30 s timeout. If real libvips work makes that tight, use small fixtures rather than raising the timeout; if a build tag is needed to keep the default suite fast, wire it into script/test so CI still runs it — an integration test excluded from CI is not one.
  5. New tests only. make check green.

Coordination

Best written after #55 merges, so it also covers the eviction wiring (StartEviction on OnStart, StopEviction on OnStop) rather than needing rework immediately. It would also have independently caught the accounting-vs-disk drift that #55's reconciliation exists to repair.

Verified against `main` at `61f42e6`. This is the "integration tests for the image proxy flow" item in `TODO.md`; confirmed genuinely missing. Every existing test stops short of the full path. `internal/imgcache/service_test.go` uses `httpfetcher.MockFetcher` reading fixtures from disk, so nothing exercises: router to handler to fetcher to libvips to disk to database, and then a second request served as a HIT. The consequence is that wiring bugs are invisible to CI. Every component can pass its unit tests while the fx graph wires them together wrongly, the cache key differs between write and read (so nothing ever hits), or the eviction goroutine never starts. The manual pass recorded in `TODO.md` is currently the only evidence the whole thing works, and it is not repeatable in CI. ## Definition of done 1. An integration test that starts the real fx application (or the real router with real components, with only the *upstream origin* replaced by an `httptest.Server`), then: - requests an image, asserting 200, correct content type, and correct decoded dimensions; - requests the same URL again and asserts it is served from cache — assert on the `X-Pixa-Cache` header and on the upstream server receiving exactly one request, not on timing; - asserts the expected files exist on disk and the expected rows exist in SQLite. 2. Uses a temporary state directory, cleaned up afterwards; no reliance on host state or network. 3. Covers at least one transform (resize + format conversion) and one `orig` passthrough. 4. Runs as part of `make test` within the existing 30 s timeout. If real libvips work makes that tight, use small fixtures rather than raising the timeout; if a build tag is needed to keep the default suite fast, wire it into `script/test` so CI still runs it — an integration test excluded from CI is not one. 5. New tests only. `make check` green. ## Coordination Best written **after** #55 merges, so it also covers the eviction wiring (`StartEviction` on `OnStart`, `StopEviction` on `OnStop`) rather than needing rework immediately. It would also have independently caught the accounting-vs-disk drift that #55's reconciliation exists to repair.
clawbot added this to the 1.0.0 milestone 2026-08-09 03:48:52 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#80