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 nil check for storage class name #2976

Merged
merged 2 commits into from
Sep 21, 2020

Conversation

stoneshi-yunify
Copy link
Member

@stoneshi-yunify stoneshi-yunify commented Sep 14, 2020

Signed-off-by: stoneshi-yunify 70880165+stoneshi-yunify@users.noreply.github.com

What type of PR is this?
/kind bug

What this PR does / why we need it:
Avoid panic(Internal server error) when searching PVCs with an empty storage class name.

Which issue(s) this PR fixes:

Fixes kubesphere/ks-installer#1109

Special notes for reviewers:

Additional documentation, usage docs, etc.:


Signed-off-by: stoneshi-yunify <70880165+stoneshi-yunify@users.noreply.github.com>
@ks-ci-bot ks-ci-bot added kind/bug Categorizes issue or PR as related to a bug. dco-signoff: yes size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 14, 2020
@codecov
Copy link

codecov bot commented Sep 14, 2020

Codecov Report

Merging #2976 into master will decrease coverage by 0.77%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2976      +/-   ##
=========================================
- Coverage   10.75%   9.98%   -0.78%     
=========================================
  Files         194     195       +1     
  Lines       41988   38921    -3067     
=========================================
- Hits         4516    3885     -631     
+ Misses      36894   34470    -2424     
+ Partials      578     566      -12     
Flag Coverage Δ
#unittests 9.98% <100.00%> (-0.78%) ⬇️

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

Impacted Files Coverage Δ
.../resources/v1alpha2/storageclass/storageclasses.go 51.35% <100.00%> (ø)
...ller/destinationrule/destinationrule_controller.go 36.81% <0.00%> (-10.07%) ⬇️
pkg/db/condition.go 40.74% <0.00%> (-9.26%) ⬇️
pkg/simple/client/mysql/condition.go 40.74% <0.00%> (-9.26%) ⬇️
.../models/resources/v1alpha3/configmap/configmaps.go 52.63% <0.00%> (-7.37%) ⬇️
...esources/v1alpha3/networkpolicy/networkpolicies.go 52.63% <0.00%> (-7.37%) ⬇️
pkg/models/resources/v1alpha3/service/services.go 36.84% <0.00%> (-7.16%) ⬇️
.../models/resources/v1alpha3/workspace/workspaces.go 36.84% <0.00%> (-7.16%) ⬇️
...els/resources/v1alpha3/rolebinding/rolebindings.go 36.84% <0.00%> (-7.16%) ⬇️
...s/v1alpha3/globalrolebinding/globalrolebindings.go 36.84% <0.00%> (-7.16%) ⬇️
... and 185 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f12f72...7fe78e4. Read the comment docs.

@stoneshi-yunify
Copy link
Member Author

/assign @zheng1 @min-zh

@zheng1
Copy link
Member

zheng1 commented Sep 18, 2020

Please add more unit tests for this file.

Signed-off-by: stoneshi-yunify <70880165+stoneshi-yunify@users.noreply.github.com>
@ks-ci-bot ks-ci-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 21, 2020
@stoneshi-yunify
Copy link
Member Author

@zheng1 @min-zh Unit tests added, please review again. thanks.

@min-zh
Copy link
Contributor

min-zh commented Sep 21, 2020

/lgtm

@ks-ci-bot ks-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2020
@stoneshi-yunify
Copy link
Member Author

@zheng1
Copy link
Member

zheng1 commented Sep 21, 2020

/lgtm
/approve

@ks-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: stoneshi-yunify, zheng1
To complete the pull request process, please assign rayzhou2017
You can assign the PR to them by writing /assign @rayzhou2017 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal Server Error
4 participants