Skip to content

Report a failed automigrate on volume resize instead of throwing NPE - #14752

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-resize-automigrate-npe
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-resize-automigrate-npe

Conversation

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator

Description

Fixes #14751

path before after
resizeVolume, migration returns null NullPointerException "... the migration did not return the migrated volume"
resizeVolume, migration throws generic error, cause dropped error includes the cause message and keeps it as cause
changeOfferingForVolume, migration returns null message said "volume: null" names the volume
changeOfferingForVolume, either case named the first suitable pool, not the one tried names the pool actually tried
  • One helper does the migrate-and-check for both paths.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Bug Severity

  • Minor

How Has This Been Tested?

test result
VolumeApiServiceImplTest (148 tests, 3 new) pass
the 3 new tests against the unfixed code fail as expected (1 NPE, 2 wrong messages)

When resizeVolume needs to move the volume to another pool and
migrateVolume returns null, the code set `volume` to null and then
called `volume.getUuid()` to build the error, both in the try and in
the catch. The caller got a NullPointerException.

| path | before | after |
|---|---|---|
| resizeVolume, migration returns null | NullPointerException | "... the migration did not return the migrated volume" |
| resizeVolume, migration throws | generic error, cause dropped | error includes the cause message and keeps it as cause |
| changeOfferingForVolume, migration returns null | message said "volume: null" | names the volume |
| changeOfferingForVolume, either case | named the first suitable pool, not the one tried | names the pool actually tried |

- Move the migrate-and-check into one helper used by both paths.
- Add unit tests for the null and exception cases of resizeVolume and
  the null case of changeOfferingForVolume.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.32%. Comparing base (b56bbc2) to head (7b28ff5).

Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14752   +/-   ##
=========================================
  Coverage     18.32%   18.32%           
- Complexity    16644    16646    +2     
=========================================
  Files          5939     5939           
  Lines        537787   537787           
  Branches      65932    65930    -2     
=========================================
+ Hits          98544    98564   +20     
+ Misses       428033   428013   -20     
  Partials      11210    11210           
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.41% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

This branch has not been deployed

No deployments
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.

1 participant