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

fix: add storage_limit check #19095

Merged
merged 1 commit into from
Aug 9, 2023
Merged

fix: add storage_limit check #19095

merged 1 commit into from
Aug 9, 2023

Conversation

zyyw
Copy link
Contributor

@zyyw zyyw commented Aug 3, 2023

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Issue being fixed

Fixes #18091
task item: 1

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.

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #19095 (2243347) into main (bd34ad5) will increase coverage by 0.00%.
The diff coverage is 56.52%.

❗ Current head 2243347 differs from pull request most recent head 2722954. Consider uploading reports for the commit 2722954 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #19095   +/-   ##
=======================================
  Coverage   67.39%   67.40%           
=======================================
  Files         992      993    +1     
  Lines      108791   108812   +21     
  Branches     2751     2751           
=======================================
+ Hits        73325    73345   +20     
+ Misses      31528    31525    -3     
- Partials     3938     3942    +4     
Flag Coverage Δ
unittests 67.40% <56.52%> (+<0.01%) ⬆️

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

Files Changed Coverage Δ
src/pkg/config/manager.go 45.23% <0.00%> (-3.90%) ⬇️
src/pkg/quota/types/resources.go 83.56% <ø> (ø)
src/controller/quota/driver/project/project.go 39.13% <100.00%> (+15.94%) ⬆️
src/lib/quota_storage_limit.go 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

Copy link
Contributor

@AllForNothing AllForNothing left a comment

Choose a reason for hiding this comment

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

lgtm

strVal := utils.GetStrValueOfAnyType(value)

// check storage per project before setting it
if key == common.StoragePerProject {
Copy link
Contributor

Choose a reason for hiding this comment

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

why put the specific checking at here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the check is only for common.StoragePerProject

if err != nil {
return fmt.Errorf("cannot parse string value(%v) to int64", strVal)
}
if storagePerProject <= 0 {
Copy link
Contributor

@stonezdj stonezdj Aug 7, 2023

Choose a reason for hiding this comment

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

Because same code appear twice, suggest to extract to function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the review. It has been refactored.

…hod to validate quota limit value)

Signed-off-by: Shengwen Yu <[email protected]>
@zyyw zyyw merged commit 90de909 into goharbor:main Aug 9, 2023
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validators for Harbor APIs
5 participants