Repository navigation
test: adopt rstest for parameterized tests - #24
Merged
Merged
Conversation
remdalm
marked this pull request as draft
October 24, 2026 09:52
remdalm
marked this pull request as ready for review
October 24, 2026 10:04
jjhafer
requested changes
Oct 24, 2026
- Stream a chunked body so the mid-stream body limit check runs - Pin the early Content-Length rejection by its advertised size, replacing a test that passed even without the early check - Assert lower bounds in the backoff tests, and that jitter varies - Check that InFlightRequests::default() and new() start empty - Use a forbidden header to show merge_headers passes defaults through, and assert ForbiddenHeader in the per-request rejection test - Revoke a runtime domain mid-retry to test allowlist revalidation - Make the security-error retry test fail during an attempt; its old error was raised before the retry loop, so it could never have been retried - Cover Error::Request codes and the retryable timeout and connect branch - Check the full message in every error serialization test - Pass a real String in test_body_from_string
reqwest's Attempt::previous() includes the original request URL, so the `previous().len() >= max_redirects` check stopped one redirect early: max_redirects(1) followed none and the default of 10 followed 9. Use `>`, as reqwest's own Policy::limited does, and add a test for a chain that is exactly max_redirects long. The hop-limit tests now assert the exact status and, where the status cannot tell where the chain stopped, the final URL. Accepting any 3xx let them pass with the bug.
Tests that ran the same check on several inputs, in one function or in sibling functions, are now #[rstest] tables with one named case per input. Each input passes or fails on its own and can be run by name. Scenarios, multi-aspect checks and stateful sequences stay plain #[test] functions. Every input is still checked. The few that were checked twice (the 408 status, POST and PATCH, the first backoff attempt) now appear once, with their rationale kept as a comment on the case. The tables hold 246 cases in 45 functions. Two changes go beyond moving tests into tables: - test_validate_header_name_blocks asserts ForbiddenHeader with the lowercased name instead of just is_err(). This covers test_validate_header_name_blocks_host, which becomes the host_lower case, and test_validate_header_name_error_contains_lowercased_name, which is removed. - The three pack_ipc_response body tests become one table that compares the bytes after the metadata with the input body. Their different status codes and headers did not matter to what they tested. rstest 0.28.0 is a dev-dependency with default features off, as tauri-plugin-connectivity does.
7 tasks
velocitysystems
approved these changes
Oct 25, 2026
jjhafer
approved these changes
Oct 25, 2026
4 tasks
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.
No description provided.