Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 14, 2025

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 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 Copilot AI requested a review from TerryHowe September 14, 2025 12:25
Copilot finished work on behalf of TerryHowe September 14, 2025 12:25
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.35%. Comparing base (d19ca44) to head (06cfd3a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1861      +/-   ##
==========================================
+ Coverage   85.32%   85.35%   +0.02%     
==========================================
  Files         143      143              
  Lines        6739     6739              
==========================================
+ Hits         5750     5752       +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
Copy link
Member

@TerryHowe TerryHowe left a comment

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
Copy link
Contributor

@Copilot Copilot AI left a comment

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.

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@Copilot Copilot AI requested a review from shizhMSFT September 23, 2025 06:59
Copilot finished work on behalf of shizhMSFT September 23, 2025 06:59
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT
Copy link
Contributor

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

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*
3 participants