Skip to content

Conversation

@ManishhDev
Copy link
Contributor

Fixes #1863

Added unit tests for manifest_delete.go, manifest_index.go and manifest_push.go. These were missing test coverage so I wrote tests covering all the main methods in each handler.

Tests include:

  • ManifestDeleteHandler methods (OnManifestMissing, OnManifestDeleted)
  • ManifestIndexCreateHandler methods (OnTagged, OnIndexCreated, Render)
  • ManifestPushHandler methods (OnTagged, OnManifestPushed, Render)

What this PR does / why we need it:
Adds missing test coverage for the manifest handlers to help catch bugs and make the code more reliable.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1863

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?

Copilot AI and others added 4 commits October 22, 2025 20:45
…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>
…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>
Signed-off-by: ManishhDev <codermanishhh@gmail.com>
@ManishhDev
Copy link
Contributor Author

Hi,
All checks have passed and the PR is ready for review.
Could a code owner please take a look and approve for merging?
Thanks!

Copy link
Contributor

@wangxiaoxuan273 wangxiaoxuan273 left a comment

Choose a reason for hiding this comment

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

LGTM but I am not a maintainer.

@TerryHowe TerryHowe requested a review from Copilot October 23, 2025 15:58
Copy link
Contributor

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 addresses issue #1863 by adding comprehensive unit test coverage for three previously untested manifest handler modules. The tests verify the core functionality of manifest deletion, index creation, and manifest push operations.

Key Changes:

  • Added test coverage for ManifestDeleteHandler with tests for OnManifestMissing and OnManifestDeleted methods
  • Added test coverage for ManifestIndexCreateHandler with tests for OnTagged, OnIndexCreated, and Render methods
  • Added test coverage for ManifestPushHandler with tests for OnTagged, OnManifestPushed, and Render methods

Reviewed Changes

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

File Description
cmd/oras/internal/display/metadata/text/manifest_delete_test.go Implements unit tests for manifest deletion handler methods and constructor
cmd/oras/internal/display/metadata/text/manifest_index_test.go Implements unit tests for manifest index creation handler methods and constructor
cmd/oras/internal/display/metadata/text/manifest_push_test.go Implements unit tests for manifest push handler methods and constructor

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

@TerryHowe
Copy link
Member

Ignore those copilot comments. That looks like the given-when-then pattern to me pretty much.

@TerryHowe
Copy link
Member

Something wrong with the build, see the logs, but a sample:

  Error: cmd/oras/internal/display/metadata/text/manifest_delete_test.go:27:79: too many arguments in call to output.NewPrinter
  	have (*bytes.Buffer, *bytes.Buffer, bool)
  	want (io.Writer, io.Writer)

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/manifest*

3 participants