You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "magyari-adam (via GitHub)" <gi...@apache.org> on 2025/02/18 13:26:40 UTC

[PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

magyari-adam opened a new pull request, #4340:
URL: https://github.com/apache/fineract/pull/4340

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [x] Write the commit message as per https://github.com/apache/fineract/#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.
   
   - [x] Create/update unit or integration tests for verifying the changes made.
   
   - [x] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [x] 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] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #4340:
URL: https://github.com/apache/fineract/pull/4340


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4340:
URL: https://github.com/apache/fineract/pull/4340#discussion_r1967343768


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java:
##########
@@ -2231,6 +2232,7 @@ public void checkNrOfTransactionsOnSecondLoan(int nrOfTransactionsExpected, Stri
     public void loanStatusHasChangedTo(String loanStatus) {
         Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
         long loanId = loanResponse.body().getLoanId();
+        await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true);

Review Comment:
   @magyari-adam This must be a mistake, no? 



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

Posted by "magyari-adam (via GitHub)" <gi...@apache.org>.
magyari-adam commented on code in PR #4340:
URL: https://github.com/apache/fineract/pull/4340#discussion_r1967359068


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java:
##########
@@ -2231,6 +2232,7 @@ public void checkNrOfTransactionsOnSecondLoan(int nrOfTransactionsExpected, Stri
     public void loanStatusHasChangedTo(String loanStatus) {
         Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
         long loanId = loanResponse.body().getLoanId();
+        await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true);

Review Comment:
   Yeah, i forgot i had to put this in, thanks for catching it.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

Posted by "oleksii-novikov-onix (via GitHub)" <gi...@apache.org>.
oleksii-novikov-onix commented on code in PR #4340:
URL: https://github.com/apache/fineract/pull/4340#discussion_r1967220893


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java:
##########
@@ -2231,6 +2232,7 @@ public void checkNrOfTransactionsOnSecondLoan(int nrOfTransactionsExpected, Stri
     public void loanStatusHasChangedTo(String loanStatus) {
         Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
         long loanId = loanResponse.body().getLoanId();
+        await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true);

Review Comment:
   `pollDelay` and `until(() -> true)` don't seem efficient. If we want to wait until the status changes, we should do something like this:
   ```
   await()
         .pollInterval(Duration.ofSeconds(1))
         .pollDelay(Duration.ofSeconds(1))
         .untilAsserted(() ->
                 eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId)
                         .extractingData(LoanAccountDataV1::getStatus)
                         .isEqualTo(expectedStatus)
         );
   ```



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2081: fix tests event check to use latest relevant event [fineract]

Posted by "oleksii-novikov-onix (via GitHub)" <gi...@apache.org>.
oleksii-novikov-onix commented on code in PR #4340:
URL: https://github.com/apache/fineract/pull/4340#discussion_r1967220893


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java:
##########
@@ -2231,6 +2232,7 @@ public void checkNrOfTransactionsOnSecondLoan(int nrOfTransactionsExpected, Stri
     public void loanStatusHasChangedTo(String loanStatus) {
         Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
         long loanId = loanResponse.body().getLoanId();
+        await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true);

Review Comment:
   `pollDelay` and `until(() -> true)` don't seem efficient. If we want to wait until the status changes, we should do something like this:
   ```
   await()
                   .pollInterval(Duration.ofSeconds(1))
                   .pollDelay(Duration.ofSeconds(1))
                   .untilAsserted(() ->
                           eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId)
                                   .extractingData(LoanAccountDataV1::getStatus)
                                   .isEqualTo(expectedStatus)
                   );
   ```



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org