Skip to content

Conversation

@SURYAS1306
Copy link

Description

Backport of #12607 to the 4.20 branch.

This change fixes an issue where account deletion was blocked if the account
was listed as an administrator of projects that were already removed
(removed is not null).

The fix ensures that only active projects are considered when checking
whether an account manages projects, allowing deletion when only deleted
projects are associated.

Includes the same defensive check and unit test added in the main branch.

Rebased to 4.20 as requested by @DaanHoogland

Fixes #12601

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Test (unit test code)

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 4.15%. Comparing base (a0f35a1) to head (77cb72f).

❗ There is a different number of reports uploaded between BASE (a0f35a1) and HEAD (77cb72f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (a0f35a1) HEAD (77cb72f)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.20   #12615       +/-   ##
=============================================
- Coverage     16.27%    4.15%   -12.12%     
=============================================
  Files          5662      404     -5258     
  Lines        500033    32965   -467068     
  Branches      60717     5893    -54824     
=============================================
- Hits          81368     1370    -79998     
+ Misses       409591    31419   -378172     
+ Partials       9074      176     -8898     
Flag Coverage Δ
uitests 4.15% <ø> (ø)
unittests ?

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

☔ View full report in Codecov by Sentry.
📢 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.

@SURYAS1306
Copy link
Author

Hi @DaanHoogland

This PR backports the fix from #12607 to the 4.20 branch.

It contains the same change and unit test as the main/4.22 fix, adjusted for the 4.20 codebase.

Please let me know if any additional changes are needed for the backport.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Co-authored-by: dahn <daan.hoogland@gmail.com>
@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16761

@sureshanaparti
Copy link
Contributor

@SURYAS1306 please check the build error.

Error:  /home/runner/work/cloudstack/cloudstack/server/src/test/java/com/cloud/user/AccountManagerImplTest.java:[1601,21] error: cannot find symbol
Error:    symbol:   variable projectAccountDao
Error:    location: class AccountManagerImplTest
Error:  /home/runner/work/cloudstack/cloudstack/server/src/test/java/com/cloud/user/AccountManagerImplTest.java:[1607,21] error: cannot find symbol
Error:    symbol:   variable projectDao
Error:    location: class AccountManagerImplTest
Error:  /home/runner/work/cloudstack/cloudstack/server/src/test/java/com/cloud/user/AccountManagerImplTest.java:[1610,8] error: cannot find symbol
Error:    symbol:   variable accountManager
Error:    location: class AccountManagerImplTest

@SURYAS1306
Copy link
Author

Hi @sureshanaparti ,

The build issue was caused by incorrect mocks in AccountManagerImplTest.
I’ve updated the test to use the injected _projectAccountDao and _projectDao fields and pushed the fix.

Could you please re-run the workflows when convenient?

@SURYAS1306
Copy link
Author

Hi @sureshanaparti

The previous build failure was due to missing imports (ProjectAccountDao, ProjectDao, InjectMocks) in AccountManagerImplTest.

I’ve added the required imports and pushed the fix in the latest commit.

Could you please re-run the workflows when possible?

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