velero icon indicating copy to clipboard operation
velero copied to clipboard

Add more nil pointer check for CSI related code in backup controller

Open blackpiglet opened this issue 2 years ago • 1 comments

Add some corner cases checking for CSI snapshot in backup controller.

Signed-off-by: Xun Jiang [email protected]

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes https://github.com/vmware-tanzu/velero/issues/5207 Fixes https://github.com/vmware-tanzu/velero/issues/5244

Please indicate you've done the following:

  • [ ] Accepted the DCO. Commits without the DCO will delay acceptance.
  • [ ] Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • [ ] Updated the corresponding documentation in site/content/docs/main.

blackpiglet avatar Sep 23 '22 08:09 blackpiglet

Codecov Report

Merging #5388 (027cba1) into main (66f6365) will increase coverage by 0.20%. The diff coverage is 9.52%.

@@            Coverage Diff             @@
##             main    #5388      +/-   ##
==========================================
+ Coverage   40.56%   40.76%   +0.20%     
==========================================
  Files         236      238       +2     
  Lines       20385    20446      +61     
==========================================
+ Hits         8269     8335      +66     
+ Misses      11511    11500      -11     
- Partials      605      611       +6     
Impacted Files Coverage Δ
pkg/builder/volume_snapshot_builder.go 0.00% <0.00%> (ø)
pkg/builder/volume_snapshot_content_builder.go 0.00% <0.00%> (ø)
pkg/controller/backup_controller.go 56.52% <42.85%> (+8.36%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Sep 23 '22 09:09 codecov-commenter

@blackpiglet Please combine all the nil-pointer checking in this PR and make sure this is cherry-picked to v1.9.3

reasonerjt avatar Oct 18 '22 07:10 reasonerjt

Tried to add a UT case for function waitVolumeSnapshotReadyToUse, but didn't make the VolumeSnapshot informer Lister work in UT, so modified according to Yonghui's suggestion. Will add the UT case later.

blackpiglet avatar Oct 20 '22 15:10 blackpiglet