Add blitz-net Provider integration tests#441
Open
tonybierman wants to merge 3 commits into
Open
Conversation
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>
Contributor
Author
|
@nicoburns Noted your comment about not getting to this until after RustWeek; I can rebase this then as needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a workspace-member test crate at
tests/blitz-net/exercising the publicProviderAPI 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 bypassesblitz-netentirely (custom NetProvider, pixel-diff assertions), so this complements WPT for structural API regression rather than overlapping it.