Repository navigation
test: add coverage for display content and json handlers - #1950
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds initial test coverage for three display package files that previously had 0% coverage: discard.go, push.go, and pull.go in the display metadata/content packages.
Key changes:
- Adds unit tests for DiscardHandler methods (OnContentFetched, OnContentCreated) and interface compliance
- Adds unit tests for JSON PushHandler methods (OnTagged, OnCopied, Render) covering both tag and digest reference scenarios
- Adds unit tests for JSON PullHandler methods (OnLayerSkipped, OnFilePulled, OnPulled, Render)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/oras/internal/display/metadata/json/push_test.go | Adds comprehensive tests for PushHandler including constructor, event handlers (OnTagged, OnCopied), and JSON rendering with both tag and digest references |
| cmd/oras/internal/display/metadata/json/pull_test.go | Adds tests for PullHandler covering constructor, layer skipping, file pulling, and JSON output rendering |
| cmd/oras/internal/display/content/discard_test.go | Adds tests for DiscardHandler verifying no-op behavior and interface compliance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add test coverage for: - content/discard.go: DiscardHandler methods - metadata/json/push.go: PushHandler methods - metadata/json/pull.go: PullHandler methods Partial: oras-project#1916 Signed-off-by: Gregorius Bima Kharisma Wicaksana <[email protected]>
6e2f273 to
cbe3cf2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
|
still working on this, will address the review comments soon |
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1950 +/- ##
==========================================
- Coverage 87.25% 87.22% -0.04%
==========================================
Files 138 138
Lines 5462 5462
==========================================
- Hits 4766 4764 -2
- Misses 415 417 +2
Partials 281 281 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fix Signed-off-by: Terry Howe <[email protected]>
Follow-up to oras-project#1950 addressing Copilot review feedback: - assert that OnTagged/OnCopied actually store the tag, path, and root - assert that OnCopied with a digest reference does NOT add a tag - assert that OnFilePulled records the file in the pulled list - assert rendered JSON contains the expected reference, digest, mediaType, size, files, and referenceAsTags rather than only validating that the output parses. Signed-off-by: Terry Howe <[email protected]>
…t#1950) Signed-off-by: Gregorius Bima Kharisma Wicaksana <[email protected]> Signed-off-by: Terry Howe <[email protected]> Co-authored-by: Terry Howe <[email protected]>
What this PR does / why we need it:
Add test coverage for display packages that currently have 0% coverage.
Files covered:
content/discard.go: Tests for DiscardHandler methods (OnContentFetched, OnContentCreated)metadata/json/push.go: Tests for PushHandler methods (OnTagged, OnCopied, Render)metadata/json/pull.go: Tests for PullHandler methods (OnLayerSkipped, OnFilePulled, OnPulled, Render)Which issue(s) this PR fixes:
Partial: #1916
Please check the following list: