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(pkg/test): split logic in pkg/test/common.go into multiple packages #1861

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

andaaron
Copy link
Contributor

@andaaron andaaron commented Sep 26, 2023

Which could be imported independently. See more details:

  1. "zotregistry.io/zot/pkg/test/common" - currently used as
    tcommon "zotregistry.io/zot/pkg/test/common" - inside pkg/test
    test "zotregistry.io/zot/pkg/test/common" - in tests
    . "zotregistry.io/zot/pkg/test/common" - in tests
    Decouple zb from code in test/pkg in order to keep the size small.

  2. "zotregistry.io/zot/pkg/test/image-utils" - curently used as
    . "zotregistry.io/zot/pkg/test/image-utils"

  3. "zotregistry.io/zot/pkg/test/deprecated" - curently used as
    "zotregistry.io/zot/pkg/test/deprecated"
    This one will bre replaced gradually by image-utils in the future.

  4. "zotregistry.io/zot/pkg/test/signature" - (cosign + notation) use as
    "zotregistry.io/zot/pkg/test/signature"

  5. "zotregistry.io/zot/pkg/test/auth" - (bearer + oidc) curently used as
    authutils "zotregistry.io/zot/pkg/test/auth"

  6. "zotregistry.io/zot/pkg/test/oci-utils" - curently used as
    ociutils "zotregistry.io/zot/pkg/test/oci-utils"

Some unused functions were removed, some were replaced, and in
a few cases specific functions were moved to the files they were used in.

Added an interface for the StoreController, this reduces the number of imports
of the entire image store, decreasing binary size for tests.
If the zb code was still coupled with pkg/test, this would have reflected in zb size.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@andaaron andaaron force-pushed the test-3 branch 3 times, most recently from a1ed1a0 to 818f725 Compare September 26, 2023 14:50
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #1861 (ae1a49b) into main (92e382c) will increase coverage by 0.03%.
The diff coverage is 85.73%.

@@            Coverage Diff             @@
##             main    #1861      +/-   ##
==========================================
+ Coverage   92.03%   92.07%   +0.03%     
==========================================
  Files         146      152       +6     
  Lines       26465    26445      -20     
==========================================
- Hits        24358    24350       -8     
+ Misses       1556     1547       -9     
+ Partials      551      548       -3     
Files Coverage Δ
pkg/compliance/v1_0_0/check.go 99.10% <100.00%> (ø)
pkg/storage/storage_controller.go 100.00% <100.00%> (ø)
pkg/test/auth/bearer.go 90.47% <ø> (ø)
pkg/test/image-utils/upload.go 83.51% <100.00%> (ø)
pkg/test/oci-utils/oci_layout.go 91.07% <100.00%> (ø)
pkg/test/oci-utils/repo.go 100.00% <ø> (ø)
pkg/test/oci-utils/store.go 100.00% <100.00%> (ø)
pkg/test/auth/oidc.go 88.00% <88.00%> (ø)
pkg/test/common/utils.go 91.01% <93.05%> (+20.04%) ⬆️
pkg/test/image-utils/utils.go 89.78% <90.19%> (+0.12%) ⬆️
... and 5 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@andaaron andaaron force-pushed the test-3 branch 2 times, most recently from 9b57c4b to 4c2e6cf Compare September 26, 2023 18:29
@andaaron andaaron changed the title refactor(pkg/test) refactor(pkg/test): split logic in pkg/test/common.go into multiple packages Sep 26, 2023
@andaaron andaaron marked this pull request as ready for review September 26, 2023 19:51
…ackages

Which could be imported independently. See more details:
1. "zotregistry.io/zot/pkg/test/common" - currently used as
   tcommon "zotregistry.io/zot/pkg/test/common" - inside pkg/test
   test "zotregistry.io/zot/pkg/test/common" - in tests
   . "zotregistry.io/zot/pkg/test/common" - in tests
Decouple zb from code in test/pkg in order to keep the size small.

2. "zotregistry.io/zot/pkg/test/image-utils" - curently used as
   . "zotregistry.io/zot/pkg/test/image-utils"

3. "zotregistry.io/zot/pkg/test/deprecated" -  curently used as
   "zotregistry.io/zot/pkg/test/deprecated"
This one will bre replaced gradually by image-utils in the future.

4. "zotregistry.io/zot/pkg/test/signature" - (cosign + notation) use as
   "zotregistry.io/zot/pkg/test/signature"

5. "zotregistry.io/zot/pkg/test/auth" - (bearer + oidc)  curently used as
   authutils "zotregistry.io/zot/pkg/test/auth"

 6. "zotregistry.io/zot/pkg/test/oci-utils" -  curently used as
   ociutils "zotregistry.io/zot/pkg/test/oci-utils"

Some unused functions were removed, some were replaced, and in
a few cases specific funtions were moved to the files they were used in.

Added an interface for the StoreController, this reduces the number of imports
of the entire image store, decreasing binary size for tests.
If the zb code was still coupled with pkg/test, this would have reflected in zb size.

Signed-off-by: Andrei Aaron <[email protected]>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

@rchincha rchincha merged commit ba6f347 into project-zot:main Sep 27, 2023
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.

[Refactor]: Move the signature related test function from pkg/test to a separate package under pkg/test
2 participants