Skip to content

test: add test coverage for cmd/oras/internal/display/metadata/text/blob* handlers#1861

Merged
TerryHowe merged 4 commits into
mainfrom
copilot/fix-1860
Oct 20, 2025
Merged

test: add test coverage for cmd/oras/internal/display/metadata/text/blob* handlers#1861
TerryHowe merged 4 commits into
mainfrom
copilot/fix-1860

Conversation

Copilot AI commented Sep 14, 2025

Copy link
Copy Markdown
Contributor

This PR adds comprehensive test coverage for the blob metadata text handlers that were previously untested. The blob handlers are responsible for formatting text output during blob push and delete operations in the ORAS CLI.

Changes Made

New Test Files Added

  • blob_push_test.go - Complete test coverage for BlobPushHandler
  • blob_delete_test.go - Complete test coverage for BlobDeleteHandler

Test Coverage Achieved

All blob handler functions now have 100% test coverage:

BlobPushHandler:

  • NewBlobPushHandler - Constructor validation
  • OnBlobPushed - Output formatting for successful blob pushes
  • Render - Digest display formatting

BlobDeleteHandler:

  • NewBlobDeleteHandler - Constructor validation
  • OnBlobMissing - Output formatting when blob is missing
  • OnBlobDeleted - Output formatting for successful blob deletions

Test Scenarios Covered

  • Registry and OCI layout target types
  • Various reference formats (digest, tag)
  • Error handling with mock error writers
  • Output validation for all handler methods
  • Constructor parameter validation

The tests follow the existing project patterns and conventions, using the same testing infrastructure as other handlers in the package (like push_test.go and restore_test.go).

Recent Updates

  • Add comprehensive test coverage for blob metadata text handlers
  • Replace fake digest sha256:abcd1234 with real digest sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 in blob_delete_test.go

Fixes #1860.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add test coverage for cmd/oras/internal/display/metadata/text/blob* Add test coverage for cmd/oras/internal/display/metadata/text/blob* handlers Sep 14, 2025
Copilot AI requested a review from TerryHowe September 14, 2025 12:25
@codecov

codecov Bot commented Sep 14, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.36%. Comparing base (7cbdb36) to head (c528a60).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1861      +/-   ##
==========================================
+ Coverage   85.33%   85.36%   +0.02%     
==========================================
  Files         143      143              
  Lines        6743     6743              
==========================================
+ Hits         5754     5756       +2     
+ Misses        703      701       -2     
  Partials      286      286              

☔ View full report in Codecov by Sentry.
📢 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 marked this pull request as ready for review September 14, 2025 12:32

@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

@shizhMSFT shizhMSFT changed the title Add test coverage for cmd/oras/internal/display/metadata/text/blob* handlers test: add test coverage for cmd/oras/internal/display/metadata/text/blob* handlers Sep 23, 2025
Co-authored-by: TerryHowe <104113+TerryHowe@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive test coverage for the blob metadata text handlers in the ORAS CLI that were previously untested. The handlers are responsible for formatting text output during blob push and delete operations.

  • Adds complete test coverage for BlobPushHandler including constructor validation, output formatting, and digest display
  • Adds complete test coverage for BlobDeleteHandler including constructor validation and output formatting for missing/deleted blobs
  • Tests cover various scenarios including registry/OCI layout targets, different reference formats, and error handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
blob_push_test.go Adds comprehensive tests for BlobPushHandler covering constructor, OnBlobPushed, and Render methods
blob_delete_test.go Adds comprehensive tests for BlobDeleteHandler covering constructor, OnBlobMissing, and OnBlobDeleted methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread cmd/oras/internal/display/metadata/text/blob_delete_test.go Outdated
…bcd1234

Co-authored-by: shizhMSFT <32161882+shizhMSFT@users.noreply.github.com>

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT

Copy link
Copy Markdown
Contributor

I guess this requires review from @Wwwsylvia as the copilot added commits on my behalf.

@Wwwsylvia Wwwsylvia 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 2650304 into main Oct 20, 2025
8 checks passed
ManishhDev pushed a commit to ManishhDev/oras that referenced this pull request Oct 22, 2025
…lob* handlers (oras-project#1861)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TerryHowe <104113+TerryHowe@users.noreply.github.com>
Co-authored-by: shizhMSFT <32161882+shizhMSFT@users.noreply.github.com>
Co-authored-by: Terry Howe <terrylhowe@gmail.com>
Signed-off-by: ManishhDev <codermanishhh@gmail.com>
ManishhDev pushed a commit to ManishhDev/oras that referenced this pull request Oct 22, 2025
…lob* handlers (oras-project#1861)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TerryHowe <104113+TerryHowe@users.noreply.github.com>
Co-authored-by: shizhMSFT <32161882+shizhMSFT@users.noreply.github.com>
Co-authored-by: Terry Howe <terrylhowe@gmail.com>
Signed-off-by: ManishhDev <codermanishhh@gmail.com>
@TerryHowe TerryHowe deleted the copilot/fix-1860 branch June 11, 2026 14:51
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.

Add test coverage for cmd/oras/internal/display/metadata/text/blob*

5 participants