Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Refactor of the publish path and HttpTransport #162

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

AllexVeldman
Copy link
Owner

@AllexVeldman AllexVeldman commented Jan 30, 2025

To improve the testability of publishing a package, PyOci.publish_package() is split into multiple methods.

Tests for the refactored parts were moved/restructured so it is no longer needed to go through the entire request flow for every test (including mockito).

A new Trait Transport is introduced and PyOci is generic over Transport.
This allows swapping the HttpTransport in unittests in the future, removing the need to mockito in a lot of cases.

Annotations have been structured a bit more.

  • ImageIndex annotations will only include it's creation timestamp
  • ImageIndex.manifests[] annotations will include package metadata we might need when listing/searching packages
  • ImageManifest annotations will contain user-defined labels through PyOci :: Label :: classifiers.

The com.pyoci.sha256_digest annotation is added containing the SHA256 digest of the package blob.
This is a first step to make #160 work in an effective manner.

BEGIN_COMMIT_OVERRIDE
refactor: Refactor of the publish path and HttpTransport #162

feat: SHA256 digest of the provided content is checked against the provided sha256_digest in the request. #162

END_COMMIT_OVERRIDE

@AllexVeldman AllexVeldman self-assigned this Jan 30, 2025
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 99.85294% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.04%. Comparing base (6140d20) to head (f006377).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/package.rs 98.24% 1 Missing ⚠️
Additional details and impacted files

To improve the testability of publishing a package,
`PyOci.publish_package()` is split into multiple methods.

Tests for the refactored parts were moved/restructured so it is no longer needed
to go through the entire request flow for every test (including mockito).

A new Trait `Transport` is introduced and `PyOci` is generic over `Transport`.
This allows swapping the `HttpTransport` in unittests in the future,
removing the need to mockito in a lot of cases.

Annotations have been structured a bit more.
- ImageIndex annotations will only include it's creation timestamp
- ImageIndex.manifests[] annotations will include package metadata
  we might need when listing/searching packages
- ImageManifest annotations will contain user-defined labels through
  `PyOci :: Label :: ` classifiers.

The `com.pyoci.sha256_digest` annotation is added containing the SHA256 digest
of the package blob.
This is a first step to make #160 work in an effective manner.

The SHA256 digest of the provided content is checked against the provided
`sha256_digest` in the request.
@AllexVeldman AllexVeldman merged commit 968afe8 into main Jan 30, 2025
6 checks passed
@AllexVeldman AllexVeldman deleted the refactor/testability branch January 30, 2025 13:18
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.

1 participant