Skip to content

Add blitz-net Provider integration tests#441

Open
tonybierman wants to merge 3 commits into
DioxusLabs:mainfrom
tonybierman:feat/blitz-net-tests
Open

Add blitz-net Provider integration tests#441
tonybierman wants to merge 3 commits into
DioxusLabs:mainfrom
tonybierman:feat/blitz-net-tests

Conversation

@tonybierman
Copy link
Copy Markdown
Contributor

Adds a workspace-member test crate at tests/blitz-net/ exercising the public Provider API directly with wiremock — scheme dispatch, HTTP status mapping, body encoding, abort signals, per-host concurrency, redirects, and feature-gated paths (cookies, cache, multipart). WPT covers rendering conformance but its runner bypasses blitz-net entirely (custom NetProvider, pixel-diff assertions), so this complements WPT for structural API regression rather than overlapping it.

tonybierman and others added 3 commits May 14, 2026 03:49
Workspace-member test crate (tests/blitz-net) covering Provider public-API
behavior that WPT can't reach: scheme dispatch, HTTP status mapping, body
encoding, abort signals, per-host concurrency limits, and feature-gated
paths (cookies, cache, multipart). Uses wiremock for in-process HTTP servers.

Also fixes file:// URL handling on Windows (the new tests surfaced it):
url.path() returns a URL-encoded path with a leading `/` that isn't a valid
filesystem path on Windows; use url::Url::to_file_path instead.

CI runs default-feature tests via the existing workspace job and adds a
dedicated job for cookies+cache and cookies+multipart combos (mutually
incompatible in blitz-net). Clippy lints both feature combinations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add Provider::with_cache_dir(waker, dir) under the cache feature so tests can
point at a TempDir instead of the production cache directory shared with the
running app. Cache tests now each use an isolated dir; the OnceLock serialization
is dropped since concurrency no longer matters when state is per-test.

Redirect coverage: loop detection, 307 POST method preservation, 302 POST→GET
(the last pins reqwest's browser-compat behavior so future drift surfaces).

Abort coverage: pre-dispatch abort returns immediately with handler skipped,
abort-after-completion is a no-op, single AbortController shared across two
in-flight requests aborts both.

CI adds a Windows job running cargo test -p blitz-net-tests to verify the
file:// handling fix on the platform it targets.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The two-mock arrangement (path("/") + path("/loop") cycling) returned
Ok((url, b"ok")) on macOS — body that doesn't come from either mock,
suggesting cross-test response bleed in wiremock under macOS parallelism.

Rewrite as a single catch-all GET mock that 302s every request to /loop.
reqwest follows up to its limit then errors with TooManyRedirects. No
path matching, no second mock to time-race. Also panic with the unexpected
Ok value so any future regression surfaces with the body content.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tonybierman
Copy link
Copy Markdown
Contributor Author

@nicoburns Noted your comment about not getting to this until after RustWeek; I can rebase this then as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant