Repository navigation
test(registry): fix blob upload mock responses - #604
Merged
yizha1 merged 2 commits intoNov 30, 2026
Merged
Conversation
cshung
requested review from
NiazFK,
gokarnm,
priteshbandi,
rgnote,
shizhMSFT,
toddysm,
vaninrao10 and
yizha1
as code owners
November 30, 2026 18:46
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the test-only registry upload mock update.
No open issues 🎉
What changed in this PR
Repairs the registry blob-upload test mock to support newer ORAS upload-host validation, addressing #587 without changing production code or dependencies.
Changes:
- Preserves the original request so relative upload locations resolve against the registry URL.
- Returns
/v2/test/blobs/uploads/testas the upload-session location. - Handles the follow-up upload request with
201 Created.
| File | Description |
|---|---|
registry/repository_test.go |
Corrects mock response request metadata, upload location, and follow-up routing. |
Review effort: Balanced
Preserve the incoming request on the mock upload response so relative Location headers can be resolved against the original registry URL. Return an upload-session path and handle the follow-up request at that path with 201 Created. This makes the mock compatible with the upload host validation introduced in ORAS 2.6.2 without weakening the validation or changing production code. It also unblocks the registry tests for the ORAS 2.7 upgrade in notaryproject#598. Credit to siretart for documenting the root cause and providing this mock correction in the Debian investigation: notaryproject#587 (comment) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3a297bdb-d8ae-492d-bae7-d555afa73630 Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
cshung
force-pushed
the
users/yinghungau/registry-upload-mock
branch
from
November 30, 2026 18:52
18f5982 to
b8c4c99
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #604 +/- ##
=======================================
Coverage 82.94% 82.94%
=======================================
Files 36 36
Lines 2645 2645
=======================================
Hits 2194 2194
Misses 310 310
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Correct the blob-upload responses in
mockRemoteClient.Do:http.Response.Location()can resolve relative upload URLs against the registry URL./v2/test/blobs/uploads/testas the upload-session location.201 Created.The previous response had no request URL, so newer ORAS upload-host validation resolved the relative location without a registry host and rejected it. This repairs the mock rather than bypassing or weakening the host/scheme checks.
Only
registry/repository_test.gochanges. No production code, dependencies, Go minimum version, or error-message changes are included.This applies the correction already documented in the Debian investigation.
Fixes #587. Related: #598.
Validation
With the current dependencies (ORAS 2.6.0):
In an isolated source snapshot inside the candidate checkout, with ORAS 2.7.0 and Go 1.26.0:
go vet ./registrypassed.Formatting and
git diff --checkpassed. These are local results; upstream CI is separate.