SURYAS1306 commented on PR #12615:
URL: https://github.com/apache/cloudstack/pull/12615#issuecomment-3929600988

   Hi @DaanHoogland,
   
   Following your suggestion, I reviewed #12632 and updated the test to stop 
mocking `getCurrentCallingAccount()` and use `CallContext`.
   
   However, the CI still fails in `AccountManagerImplTest` during the setup 
phase:
   
   `AccountManagerImplTest.setUp:167 NotAMock – Argument passed to when() is 
not a mock`
   
   From the logs, all failures occur before any assertions run (the previous 
test class passes), meaning the failure is caused by the test initialization 
itself rather than the account deletion change in this PR.
   
   While debugging I noticed `AccountManagerImplTestBase` creates real 
instances that override Mockito-injected mocks, so `when(...)` sometimes 
executes on non-mock objects depending on initialization order.
   
   I tried:
   
   * removing manual mocks
   * relying only on `@Mock` injection
   * using `@BeforeClass`
   * using `CallContext`
   * avoiding `spy`
   
   but the failures persist and appear related to the legacy Mockito lifecycle 
in this test rather than the change introduced here.
   
   Since this is a 4.20 backport, would you prefer:
   
   1. keeping the functional fix minimal and not refactoring the legacy test, or
   2. aligning the test structure with the cleanup approach from #12632 first?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to