Skip to content

test: fix testRestoreVirtualMachineWhenHostRemoved failure - #14035

Open
shwstppr wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-main-testfailure
Open

test: fix testRestoreVirtualMachineWhenHostRemoved failure#14035
shwstppr wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-main-testfailure

Conversation

@shwstppr

@shwstppr shwstppr commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

Build was failing with,

18:53:06 [ERROR] Errors:
18:53:06 [ERROR]   UserVmManagerImplTest.testRestoreVirtualMachineWhenHostRemoved:1886 ? NullPointer

Build failure seen in healthcheck PR as well, #14028 (comment)

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

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>
Copilot AI lite review requested due to automatic review settings September 2, 2026 14:04
@shwstppr

shwstppr commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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 InternalBackupService Mockito mock so UserVmManagerImpl’s internalBackupService dependency 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

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.78%. Comparing base (3d70ce4) to head (d257f16).

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     
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 21.06% <ø> (?)

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.

@weizhouapache

Copy link
Copy Markdown
Member

a new error when start simulator CI env


Starting Advanced Zone DataCenter deployment
Traceback (most recent call last):
  File "/home/runner/work/cloudstack/cloudstack/tools/marvin/marvin/deployDataCenter.py", line 28, in <module>
    from marvin import configGenerator
  File "/home/runner/.local/lib/python3.10/site-packages/marvin/configGenerator.py", line 21, in <module>
    from . import jsonHelper
  File "/home/runner/.local/lib/python3.10/site-packages/marvin/jsonHelper.py", line 20, in <module>
    from marvin.cloudstackAPI import *
  File "/home/runner/.local/lib/python3.10/site-packages/marvin/cloudstackAPI/createKubernetesCluster.py", line 94
    """(Optional) Node Type to Service Offering ID mapping. If provided, it overrides the serviceofferingid parameter. Example: nodeofferings[0].node="control"&nodeofferings[0].offering="<service-offering-uuid>"&nodeofferings[1].node="worker"&nodeofferings[1].offering="<service-offering-uuid>""""
                                                                                                                                                                                                                                                                                                        ^
SyntaxError: unterminated string literal (detected at line 94)```

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19067

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants