Skip to content

Share OSV advisory test mocks - #1106

Draft
zaniebot wants to merge 2 commits into
mainfrom
zb/share-osv-test-mock
Draft

zaniebot wants to merge 2 commits into
mainfrom
zb/share-osv-test-mock

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Move the repeated OSV querybatch and advisory responses into a small uv-test helper, following the request in astral-sh#18936. The malware-detection tests for uv add, uv run, and uv sync now share the same fixtures while retaining their existing setup order. Specialized authentication, request-count, and failure mocks remain explicit.

@astral-automations-bot astral-automations-bot Bot added internal A refactor or improvement that is not user-facing internal:testing Internal testing of behavior labels Sep 9, 2026
@zaniebot zaniebot added priority:4 Low: worthwhile tests, refactors, or maintenance with modest immediate benefit. size:1 Small: one localized behavior with straightforward tests or documentation checks. risk:0 No meaningful change to product, state, release, or automation behavior. labels Sep 9, 2026
@codspeed

codspeed Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 41 untouched benchmarks
⏩ 16 skipped benchmarks1


Comparing zb/share-osv-test-mock (1e99af1) with main (80176d6)

Open in CodSpeed

Footnotes

  1. 16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread crates/uv-test/src/osv.rs Outdated
Comment on lines +47 to +52
assert_eq!(
response,
json!({
"id": "MAL-2026-1234",
"modified": "2026-01-01T00:00:00Z",
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Remove the unit test that only echoes fixture JSON

This test verifies that Wiremock returns the static JSON supplied to set_body_json, including the arbitrary timestamp. None of the three migrated commands consumes this GET response: check_malware_dependencies calls Osv::query_identifiers, which only requests /querybatch. The test therefore adds fixture data to maintain without exercising the behavior supported by this refactor. Remove it and rely on the existing add_malware_detected, run_malware_detected, and sync_malware_detected snapshots, which exercise the shared batch response through uv's client.

This branch was successfully deployed

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

Labels

internal:testing Internal testing of behavior internal A refactor or improvement that is not user-facing priority:4 Low: worthwhile tests, refactors, or maintenance with modest immediate benefit. project:maintainer-followups Maintainer follow-up work risk:0 No meaningful change to product, state, release, or automation behavior. size:1 Small: one localized behavior with straightforward tests or documentation checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants