[ 
https://issues.apache.org/jira/browse/FINERACT-2989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135195#comment-18135195
 ] 

Piotr Wargulak commented on FINERACT-2989:
------------------------------------------

Reproduced locally and confirmed the timing cause.

The step takes the latest Status Changed event already received for the loan, 
and stops waiting as soon as one is there. UC40 raises one on approval (200), 
disbursal (300), the closing repayment (600) and the re-opening adjustment 
(300). The E2E suite publishes events once a second, so when a publish lands 
before the adjustment's event goes out, the step checks an earlier event. That 
gives 600, or 200 (seen on apache/fineract#6692).

Measured with the E2E workflow's compose stack and settings: UC40 repeated 
failed 32 of 125 runs (both 200 and 600). With a 1.5 s wait before the 
adjustment, it failed 8 of 10.

Fix in https://github.com/apache/fineract/pull/6791: ask the server how many 
Status Changed events it persisted for the loan, wait until that many are 
received, then check the latest as before. 
With it, 230 of 230 UC40 runs passed, and the six feature files using the step 
(107 scenarios) pass. 
On a local server mutated so that adjust-by-delta raises no Status Changed 
event, the fixed step fails 50 of 50. It still catches a missing event.

> Flaky E2E: Working Capital adjust-by-delta UC40 status changed event check 
> sometimes sees status 600 instead of 300
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2989
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2989
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Savings
>            Reporter: LeeYoonMyeong
>            Assignee: Piotr Wargulak
>            Priority: Major
>
> The E2E scenario "Verify Working Capital Loan adjust by delta transaction - 
> UC40: full decrease of closing repayment re-opens loan and raises status 
> changed event" ({{WorkingCapitalLoanAdjustByDelta-Adjust.feature}}, added in 
> FINERACT-2455) fails intermittently in the step "a Working Capital Loan 
> Status Changed business event is raised":
> {noformat}
> org.opentest4j.AssertionFailedError: [status.id]
> expected: 300L
>  but was: 600L
>       at 
> org.apache.fineract.test.messaging.event.EventCheckHelper.assertWorkingCapitalLoanAccountData(EventCheckHelper.java:1578)
>       at 
> org.apache.fineract.test.messaging.event.EventCheckHelper.workingCapitalLoanStatusChangedEventCheck(EventCheckHelper.java:812)
> {noformat}
> Observed results for the same scenario:
> * develop at ad98847: failed - 
> https://github.com/apache/fineract/actions/runs/40026935216/job/120669893735
> * develop at 4c9ec8d: passed - 
> https://github.com/apache/fineract/actions/runs/40090963619/job/120865834646
> * PR #6731 (based on 4c9ec8d, only changes TaxUtils): failed - 
> https://github.com/apache/fineract/actions/runs/40092299403/job/120868874199
> In this scenario the loan is first closed (status 600, 
> CLOSED_OBLIGATIONS_MET) and then re-opened (status 300, ACTIVE), so two 
> Status Changed events are raised for the same loan. The check may be matching 
> the earlier event depending on timing (not verified).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to