Skip to content

Conversation

@MinerYang
Copy link
Contributor

Thank you for contributing to Harbor!

Comprehensive Summary of your change

lazy load v2_swagger_client module when running Setup robot case before swagger file generated.

Issue being fixed

#22123

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@MinerYang MinerYang requested a review from a team as a code owner July 4, 2025 12:47
@MinerYang MinerYang requested a review from Copilot July 4, 2025 12:50
@codecov
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.88%. Comparing base (c8c11b4) to head (71cc70c).
Report is 505 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22154       +/-   ##
===========================================
+ Coverage   45.36%   65.88%   +20.51%     
===========================================
  Files         244     1072      +828     
  Lines       13333   115713   +102380     
  Branches     2719     2925      +206     
===========================================
+ Hits         6049    76238    +70189     
- Misses       6983    35249    +28266     
- Partials      301     4226     +3925     
Flag Coverage Δ
unittests 65.88% <ø> (+20.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 986 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

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 introduces lazy loading of the v2_swagger_client module via importlib to avoid import errors before the Swagger client is generated. It replaces direct imports and references with calls to a local swagger_module helper.

  • Added a swagger_module helper function and replaced direct v2_swagger_client imports with dynamic imports in three modules.
  • Updated API client instantiations and exception handling to use the dynamically loaded module.
  • Removed direct imports of v2_swagger_client and commented out the static ApiException import.

Reviewed Changes

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

File Description
tests/apitests/python/testutils.py Added swagger_module helper and replaced direct v2_swagger_client calls.
tests/apitests/python/library/repository.py Introduced dynamic import helper; updated API calls and exception handling.
tests/apitests/python/library/base.py Added swagger_module helper; updated client creation to use dynamic import.

@MinerYang MinerYang force-pushed the lazy_load_swagger_client branch from e715375 to 71cc70c Compare July 4, 2025 13:09
@MinerYang MinerYang added the release-note/update Update or Fix label Jul 4, 2025
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@wy65701436 wy65701436 left a comment

Choose a reason for hiding this comment

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

lgtm

@wy65701436 wy65701436 merged commit c0a859d into goharbor:main Jul 7, 2025
12 of 13 checks passed
AYDEV-FR pushed a commit to AYDEV-FR/harbor that referenced this pull request Sep 19, 2025
AYDEV-FR pushed a commit to AYDEV-FR/harbor that referenced this pull request Sep 19, 2025
AYDEV-FR pushed a commit to AYDEV-FR/harbor that referenced this pull request Sep 19, 2025
OrlinVasilev pushed a commit to OrlinVasilev/harbor that referenced this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants