test: fix testRestoreVirtualMachineWhenHostRemoved failure - #14035
test: fix testRestoreVirtualMachineWhenHostRemoved failure#14035shwstppr wants to merge 1 commit into
Conversation
Build was failing with, 18:53:06 [ERROR] Errors: 18:53:06 [ERROR] UserVmManagerImplTest.testRestoreVirtualMachineWhenHostRemoved:1886 ? NullPointer Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
|
@blueorangutan package |
|
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is a targeted, low-risk test fix that supplies a missing mocked dependency to prevent a confirmed NPE without altering production logic.
Pull request overview
This PR fixes a unit test failure in UserVmManagerImplTest by ensuring UserVmManagerImpl has all required collaborators mocked and injectable during restoreVirtualMachine(...) execution, preventing a NullPointerException in testRestoreVirtualMachineWhenHostRemoved.
Changes:
- Add a missing
InternalBackupServiceMockito mock soUserVmManagerImpl’sinternalBackupServicedependency is non-null during the restore test. - Reorder/adjust imports to match usage after adding the new mock and to keep compilation clean.
File summaries
| File | Description |
|---|---|
server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java |
Adds a mock for InternalBackupService to avoid NPE during VM restore test execution and updates related imports. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14035 +/- ##
============================================
+ Coverage 3.53% 19.78% +16.25%
- Complexity 0 19998 +19998
============================================
Files 487 6371 +5884
Lines 41863 575895 +534032
Branches 7912 70492 +62580
============================================
+ Hits 1479 113959 +112480
- Misses 40170 449510 +409340
- Partials 214 12426 +12212
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
a new error when start simulator CI env |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19067 |
Description
Build was failing with,
Build failure seen in healthcheck PR as well, #14028 (comment)
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?