test(rattler_upload): convert tests to mockito#2277
Open
benmoss wants to merge 8 commits intoconda:mainfrom
Open
test(rattler_upload): convert tests to mockito#2277benmoss wants to merge 8 commits intoconda:mainfrom
benmoss wants to merge 8 commits intoconda:mainfrom
Conversation
Replace hand-rolled axum test servers with mockito for the two simple cloudsmith tests (api_key_header, request_upload_failure) and the mod.rs cloudsmith_upload_success test. Leave the multipart upload test using axum where it's a better fit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Convert quetz, artifactory, anaconda, and prefix tests from axum to mockito. Remove the now-unused start_test_server helper from test_utils. The only remaining axum usage is the multipart cloudsmith upload test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ckito tests Replace Matcher::Any with specific path patterns for Quetz and Artifactory tests, and add mock assertions to auth failure/conflict tests to verify the expected HTTP calls are actually made. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e axum dev-dep Replace the axum-based test server in test_cloudsmith_multipart_upload_flow with mockito mocks, using expect_at_least(1) for chunk count verification. This removes the axum dev-dependency from rattler_upload. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ation Add rstest for #[case] parameterization and shared setup helpers, collapsing repeated status-code variant tests and eliminating duplicated server/client/package construction (-326/+119 lines). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid hitting real prefix.dev when running in CI where detect_ci_provider() would return Some(GitHub). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
baszalmstra
approved these changes
Mar 24, 2026
Collaborator
|
Looks good from my perspective but maybe @wolfv can take a closer look at the details. |
benmoss
commented
Mar 24, 2026
| let package = ExtractedPackage::from_package_file(&package_path).unwrap(); | ||
|
|
||
| let mock = server | ||
| .mock("POST", mockito::Matcher::Regex(r"^/stage/.*".to_string())) |
Contributor
Author
There was a problem hiding this comment.
worth pointing out that some of these are slightly more "relaxed" assertions by not asserting on the exact URL now but I don't think this was the important aspect of these tests
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.
Description
Convert all
rattler_uploadtests from custom axum-based mock servers to mockito for more declarative, readable, and maintainable HTTP mocking, then reduce boilerplate with rstest parameterization.Matcher::Anyaxumdev-dependency, addrstest(already a workspace dep)rstest#[case]to collapse repeated status-code variant tests (e.g. 3 quetz tests → 1 parameterized test)Fixes #2262
How Has This Been Tested?
All 21
rattler_uploadtests pass:Formatting and lints verified with
pixi run cargo-fmtandpixi run cargo-clippy.AI Disclosure
Tools: Claude Code (Claude Opus 4.6)
Checklist: