pwargulak opened a new pull request, #6791:
URL: https://github.com/apache/fineract/pull/6791

   ## Description
   
   [FINERACT-2989](https://issues.apache.org/jira/browse/FINERACT-2989)
   
   The E2E scenario UC40 of `WorkingCapitalLoanAdjustByDelta-Adjust.feature` 
fails intermittently in the step "a Working Capital Loan Status Changed 
business event is raised" with `[status.id] expected: 300L but was: 600L` (or 
`200L`). Seen on develop and on unrelated PRs (#6731, #6759, #6692).
   
   Cause: `EventCheckHelper#workingCapitalLoanEventMatchesApiCheck` sleeps 100 
ms and then calls `EventAssertion#assertEvent(eventClass, loanId)`, which 
returns as soon as any event of that type for the loan is in the store and 
takes the latest one received. UC40 raises a status changed event on approval 
(200), on the closing repayment (600) and on the re-opening adjustment (300). 
The suite publishes external events through "Send Asynchronous Events" once a 
second (`JobSuiteInitializerStep`), so when a publish lands after the approval 
or the close but before the adjustment's event is published, the step checks 
the earlier event.
   
   Change: the three Working Capital status changed checks (plain, timeline, 
overpaidOnDate) read the loan from the API first and wait for the status 
changed event whose `status.id` equals the API's status. `EventAssertion` gets 
an `assertEvent(eventClass, id, dataFilter)` overload and `EventStore` a 
matching `removeEventById(type, id, dataFilter)`; both take the latest matching 
event, as the existing ones do. Other checks are unchanged. Earlier status 
changed events of the same loan are left in the store unconsumed, as they were 
before.
   
   Verification, run locally against the 
`docker-compose-postgresql-test-activemq.yml` stack with the E2E workflow's 
settings (event verification on):
   
   | | without the change | with the change |
   |---|---|---|
   | UC40 repeated in one feature file | 32 of 125 runs failed (`200L` and 
`600L`) | 275 of 275 passed |
   | UC40 with a 1.5 s wait before the adjustment (a publish lands between 
close and re-open) | 8 of 10 failed (`600L`) | 20 of 20 passed |
   | UC40 with a 1.5 s wait after disbursal | 2 of 10 failed (`600L`) | 20 of 
20 passed |
   
   With the change, the six feature files that use the three steps pass: 
`WorkingCapitalLoanAccountBusinessEvents`, 
`WorkingCapitalLoanAdjustByDelta-Adjust`, 
`WorkingCapitalLoanRepaymentOverpayment`, `WorkingCapitalLoanRecoveryPayment`, 
`WorkingCapitalLoanTransactionBusinessEvents` and `WorkingCapitalLoanWriteOff` 
(107 scenarios). The image was built from #6692's head (develop of 28.10); the 
last 50 repeated runs and `WorkingCapitalLoanAdjustByDelta-Adjust` were rerun 
with this branch's test code on develop `ea2e13aa65`. Spotless, checkstyle and 
rat are clean. The rest of the E2E suite was not run locally.
   
   ## Checklist
   
   - [x] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [x] Acknowledge that we will not review PRs that are not passing the build 
_("green")_ - it is your responsibility to get a proposed PR to pass the build, 
not primarily the project's maintainers.
   - [ ] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [x] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [ ] Add required Swagger annotation and update API documentation at 
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with 
details of any API changes
   - [x] [This PR must not be a "code 
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
 Large changes can be made in a branch, with assistance. Ask for help on the 
[developer mailing list](https://fineract.apache.org/#contribute).
   - [x] If merging this PR resolves a JIRA issue, I will mark that issue as 
resolved and set "Fix Version/s" appropriately.
   - [x] I followed the [AI 
Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   


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