Skip to content

Fix KvmFileBasedStorageVmSnapshotStrategy unit test failures - #14135

Merged
weizhouapache merged 1 commit into
mainfrom
fix-test-failure
Sep 10, 2026
Merged

weizhouapache merged 1 commit into
mainfrom
fix-test-failure

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

This PR fixes build failure on main

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?

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.89%. Comparing base (4ce5291) to head (cfdd378).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##              main   #14135       +/-   ##
============================================
+ Coverage     3.71%   19.89%   +16.18%     
- Complexity       0    20142    +20142     
============================================
  Files          487     6371     +5884     
  Lines        41992   576829   +534837     
  Branches      7942    70627    +62685     
============================================
+ Hits          1558   114768   +113210     
- Misses       40208   449516   +409308     
- Partials       226    12545    +12319     
Flag Coverage Δ
uitests 3.71% <ø> (ø)
unittests 21.16% <ø> (?)

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 weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

simulator CI tests have passed

@Pearl1594

Copy link
Copy Markdown
Contributor Author

Can we merge based on the ci build status? @weizhouapache .

@blueorangutan

Copy link
Copy Markdown

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

@Pearl1594
Pearl1594 marked this pull request as ready for review September 10, 2026 17:47
Copilot AI lite review requested due to automatic review settings September 10, 2026 17:47

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 changes are small, consistent with existing dependency-injection patterns in the class, and directly resolve the unit test setup mismatch without altering core snapshot logic.

Pull request overview

This PR addresses unit test failures in the KVM file-based storage VM snapshot strategy by updating the unit test setup to reflect current production dependencies and by aligning production code visibility to support test injection.

Changes:

  • Update KvmFileBasedStorageVmSnapshotStrategyTest to mock and inject InternalBackupService into the strategy under test.
  • Adjust the unit test to use VMSnapshotHelper.getVolumeSnapshotsAssociatedWithKvmDiskOnlyVmSnapshot(...) when selecting the root snapshot’s primary datastore for NVRAM cleanup.
  • Change internalBackupService field visibility in KvmFileBasedStorageVmSnapshotStrategy to allow test injection.
File summaries
File Description
engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/KvmFileBasedStorageVmSnapshotStrategyTest.java Fixes unit test wiring by mocking InternalBackupService and matching updated strategy behavior for root snapshot datastore selection.
engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/KvmFileBasedStorageVmSnapshotStrategy.java Adjusts internalBackupService visibility to support injection in tests while preserving runtime behavior.
Review details
  • Files reviewed: 2/2 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.

@weizhouapache

Copy link
Copy Markdown
Member

Can we merge based on the ci build status? @weizhouapache .

yes @Pearl1594

merging as simulator CI and packaging job results have verified the fix

@weizhouapache
weizhouapache merged commit 72014a0 into main Sep 10, 2026
28 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Maintainability Rating on New Code (required ≥ B)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.81%
Branch coverage 19.01%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

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.

4 participants