Skip to content

test(contentutil): cover MultiReadOnlyTarget and IsDigest - #2267

Merged
TerryHowe merged 1 commit into
oras-project:mainfrom
akshita317:test/contentutil
Oct 21, 2026
Merged

TerryHowe merged 1 commit into
oras-project:mainfrom
akshita317:test/contentutil

Conversation

@akshita317

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds tests for MultiReadOnlyTarget and IsDigest in internal/contentutil, which had none:

  • Fetch and Resolve fall through targets that report not found, stop at the first other error without consulting later targets, and return not found when no target (or no target at all) has the content
  • Exists returns an error without consulting any target, since it is not implemented
  • IsDigest table test, including digests of the wrong length or case

This raises coverage of the package from 21.4% to 100%. I also checked that the tests are not vacuous: making Fetch ignore non-not-found errors fails TestMultiReadOnlyTarget_Fetch. Test-only change.

Which issue(s) this PR fixes:

N/A

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

MultiReadOnlyTarget and IsDigest had no tests. Cover the lookup order
of Fetch and Resolve: they fall through targets that report not found,
stop at the first other error without consulting later targets, and
return not found when no target has the content. Also check that
Exists reports an error without consulting any target, and table-test
IsDigest, including digests of the wrong length or case.

This raises coverage of internal/contentutil from 21.4% to 100%.

Signed-off-by: Akshita <[email protected]>
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.23%. Comparing base (38812fe) to head (9d2db32).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2267      +/-   ##
==========================================
+ Coverage   60.08%   60.23%   +0.14%     
==========================================
  Files         140      140              
  Lines        6091     6091              
==========================================
+ Hits         3660     3669       +9     
+ Misses       2209     2201       -8     
+ Partials      222      221       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe
TerryHowe merged commit bd0668e into oras-project:main Oct 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants