Shivd131 commented on PR #5353:
URL: https://github.com/apache/fineract/pull/5353#issuecomment-3824949711

   @adamsaghy thanks a lot for pointing it out, apologies for getting confused. 
   
   I modified the method, covering your points
   ```
           . . .
           // Execution Loop
           int successCount = 0;
           int validationErrorCount = 0;
           Map<String, String> failedReports = new HashMap<>(); // Track 
failures: Map<reportName, status>
   
           log.info("Starting dynamic execution of {} reports...", 
allReports.size());
   
           for (GetReportsResponse report : allReports) {
               String reportName = report.getReportName();
   
               // Execute
               Response<RunReportsResponse> response = 
fineractClient().reportsRun.runReportGetData(reportName, commonParams, 
false).execute();
   
               int statusCode = response.code();
   
               if (statusCode == 200) {
                   successCount++;
               } else if (statusCode == 400) {
                   // If it fails, ensure it's a controlled validation error, 
not a crash.
                   validationErrorCount++;
                   log.info("Report '{}' returned 400 (Expected validation 
error).", reportName);
               } else {
                   // Everything else is a FAILURE
                   log.error("Report '{}' FAILED with status: {}", reportName, 
statusCode);
                   failedReports.put(reportName, "Status: " + statusCode);
               }
           }
   
           log.info("Execution Summary: {} Success, {} Validation Errors, {} 
Failures.", successCount, validationErrorCount, failedReports.size());
   
    
           // This ensures the test fails if ANY report caused a crash.
           assertThat(failedReports).as("The following reports failed to 
execute: " + failedReports.toString()).isEqualTo(0);
   
           . . .
       }
   
   ```
   
   
   However, the test fails for these reports: 
   
   1. The Pentaho  reports were failing with a 503. Curling the endpoint and 
reading the file revealed that the method is currently returns null for 
Pentaho. We can deal with it by checking if its a Pentaho report, returning 
503: 
   ```
   if ("Pentaho".equalsIgnoreCase(reportType) && statusCode == 503)
   ```
   
   2. Regarding the 403 errors, I verified the test user has 
ALL_FUNCTIONS_READ, confirming these are data-scoping mismatches in the legacy 
SQL reports rather than missing role permissions, my assumption. So can you  
guide me into deciding how exactly should i handle them at this point?
   
   Once we figure out the 403s, the test logic would be ready to be finalized I 
believe
   
   
   ### LOGS (I have logged the names of reports and codes)
   ```
   
   
   org.apache.fineract.integrationtests.ReportExecutionIntegrationTest
   
     Test verifyClientListingReportAndMetrics() PASSED (5s)
     Test verifyAllReportsExecution() FAILED (18.9s)
   
     org.opentest4j.AssertionFailedError: [The following reports failed to 
execute: {Loan fully repaid=Status: 403, Loan payments due (Overdue 
Loans)=Status: 403, FieldAgentStats=Status: 403, Portfolio at Risk by 
Branch=Status: 403, Funds Disbursed Between Dates Summary by 
Office(Pentaho)=Status: 503, Loan Repayment=Status: 403, Portfolio at 
Risk=Status: 403, GroupSummaryAmounts=Status: 403, Client Loan Account 
Schedule=Status: 503, TxnRunningBalances(Pentaho)=Status: 503, Income 
Statement=Status: 503, Disbursal Report=Status: 503, Funds Disbursed Between 
Dates Summary(Pentaho)=Status: 503, Loan Transaction Receipt=Status: 503, Loan 
in arrears=Status: 403, Active Loans by Disbursal Period=Status: 403, 
Collection Report=Status: 503, ProgramStats=Status: 403, Savings Transaction 
Receipt=Status: 503, Portfolio at Risk(Pentaho)=Status: 503, 
ChildrenStaffList=Status: 403, Savings Rejected=Status: 403, Loans Pending 
Approval=Status: 403, Active Loans in last installment=Status: 403, Obliga
 tion Met Loans Summary(Pentaho)=Status: 503, Active Loans by Disbursal 
Period(Pentaho)=Status: 503, Active Loans - Details(Pentaho)=Status: 503, 
Active Loans - Summary=Status: 403, Aging Detail(Pentaho)=Status: 503, Loans 
Awaiting Disbursal=Status: 403, Active Loans - Summary(Pentaho)=Status: 503, 
Obligation Met Loans Details(Pentaho)=Status: 503, Savings Activated=Status: 
403, Trial Balance Summary Report with Asset Owner=Status: 403, Loan Repayment 
- Email=Status: 503, Savings Transactions=Status: 503, Client Loans 
Listing=Status: 403, Aging Summary (Arrears in Weeks)(Pentaho)=Status: 503, 
ReportCategoryList=Status: 403, Obligation Met Loans Details=Status: 403, 
Active Loans Passed Final Maturity=Status: 403, Active Loans in last 
installment Summary=Status: 403, Active Loans in last installment 
Summary(Pentaho)=Status: 503, Loans Awaiting Disbursal Summary=Status: 403, 
Savings Withdrawal=Status: 403, CoordinatorStats=Status: 403, Client Saving 
Transactions=Status: 503, GroupSummar
 yCounts=Status: 403, Active Loans in last installment(Pentaho)=Status: 503, 
Loan payments due=Status: 403, Written-Off Loans(Pentaho)=Status: 503, Active 
Loans Passed Final Maturity Summary(Pentaho)=Status: 503, Loan Approved - 
Email=Status: 503, Portfolio at Risk by Branch(Pentaho)=Status: 503, 
BranchManagerStats=Status: 403, Loans Awaiting Disbursal(Pentaho)=Status: 503, 
Rescheduled Loans(Pentaho)=Status: 503, Balance Sheet=Status: 503, Loans 
Awaiting Disbursal Summary by Month=Status: 403, Trial Balance=Status: 503, 
FieldAgentPrograms=Status: 403, GroupSavingSummary=Status: 403, Obligation Met 
Loans Summary=Status: 403, GroupNamesByStaff=Status: 403, Loan Approved=Status: 
403, Client Listing(Pentaho)=Status: 503, Active Loan Clients=Status: 403, 
Aging Summary (Arrears in Months)(Pentaho)=Status: 503, Active Loans Passed 
Final Maturity(Pentaho)=Status: 503, Expected Payments By Date - 
Formatted=Status: 503, ProgramDirectorStats=Status: 403, Active Loan Summary 
per Branch=Status: 5
 03, Loan outstanding after final instalment date=Status: 403, 
FullReportList=Status: 403, Loans Awaiting Disbursal Summary by 
Month(Pentaho)=Status: 503, Active Loans Passed Final Maturity Summary=Status: 
403, Client Loans Listing(Pentaho)=Status: 503, Savings Accounts Dormancy 
Report=Status: 403, Loan Account Schedule=Status: 503, Expected Payments By 
Date - Basic(Pentaho)=Status: 503, Loan Rejected=Status: 403, Client Savings 
Summary=Status: 503, Balance Outstanding=Status: 503, Loan payments received 
(Active Loans)=Status: 403, Savings Deposit=Status: 403, Staff Assignment 
History=Status: 503, Loan Rejected - Email=Status: 503, GeneralLedgerReport 
Table=Status: 403, Loans Pending Approval(Pentaho)=Status: 503, 
ProgramDetails=Status: 403, GeneralLedgerReport=Status: 503, Loan payments 
received (Overdue Loans)=Status: 403, Active Loans - Details=Status: 403, Loans 
Awaiting Disbursal Summary(Pentaho)=Status: 503, Branch Expected Cash 
Flow=Status: 503}] 
     expected: 0
      but was: {"Active Loan Clients"="Status: 403", "Active Loan Summary per 
Branch"="Status: 503", "Active Loans - Details"="Status: 403", "Active Loans - 
Details(Pentaho)"="Status: 503", "Active Loans - Summary"="Status: 403", 
"Active Loans - Summary(Pentaho)"="Status: 503", "Active Loans Passed Final 
Maturity"="Status: 403", "Active Loans Passed Final Maturity Summary"="Status: 
403", "Active Loans Passed Final Maturity Summary(Pentaho)"="Status: 503", 
"Active Loans Passed Final Maturity(Pentaho)"="Status: 503", "Active Loans by 
Disbursal Period"="Status: 403", "Active Loans by Disbursal 
Period(Pentaho)"="Status: 503", "Active Loans in last installment"="Status: 
403", "Active Loans in last installment Summary"="Status: 403", "Active Loans 
in last installment Summary(Pentaho)"="Status: 503", "Active Loans in last 
installment(Pentaho)"="Status: 503", "Aging Detail(Pentaho)"="Status: 503", 
"Aging Summary (Arrears in Months)(Pentaho)"="Status: 503", "Aging Summary 
(Arrears in Weeks)(P
 entaho)"="Status: 503", "Balance Outstanding"="Status: 503", "Balance 
Sheet"="Status: 503", "Branch Expected Cash Flow"="Status: 503", 
"BranchManagerStats"="Status: 403", "ChildrenStaffList"="Status: 403", "Client 
Listing(Pentaho)"="Status: 503", "Client Loan Account Schedule"="Status: 503", 
"Client Loans Listing"="Status: 403", "Client Loans Listing(Pentaho)"="Status: 
503", "Client Saving Transactions"="Status: 503", "Client Savings 
Summary"="Status: 503", "Collection Report"="Status: 503", 
"CoordinatorStats"="Status: 403", "Disbursal Report"="Status: 503", "Expected 
Payments By Date - Basic(Pentaho)"="Status: 503", "Expected Payments By Date - 
Formatted"="Status: 503", "FieldAgentPrograms"="Status: 403", 
"FieldAgentStats"="Status: 403", "FullReportList"="Status: 403", "Funds 
Disbursed Between Dates Summary by Office(Pentaho)"="Status: 503", "Funds 
Disbursed Between Dates Summary(Pentaho)"="Status: 503", 
"GeneralLedgerReport"="Status: 503", "GeneralLedgerReport Table"="Status: 403"
 , "GroupNamesByStaff"="Status: 403", "GroupSavingSummary"="Status: 403", 
"GroupSummaryAmounts"="Status: 403", "GroupSummaryCounts"="Status: 403", 
"Income Statement"="Status: 503", "Loan Account Schedule"="Status: 503", "Loan 
Approved"="Status: 403", "Loan Approved - Email"="Status: 503", "Loan 
Rejected"="Status: 403", "Loan Rejected - Email"="Status: 503", "Loan 
Repayment"="Status: 403", "Loan Repayment - Email"="Status: 503", "Loan 
Transaction Receipt"="Status: 503", "Loan fully repaid"="Status: 403", "Loan in 
arrears"="Status: 403", "Loan outstanding after final instalment date"="Status: 
403", "Loan payments due"="Status: 403", "Loan payments due (Overdue 
Loans)"="Status: 403", "Loan payments received (Active Loans)"="Status: 403", 
"Loan payments received (Overdue Loans)"="Status: 403", "Loans Awaiting 
Disbursal"="Status: 403", "Loans Awaiting Disbursal Summary"="Status: 403", 
"Loans Awaiting Disbursal Summary by Month"="Status: 403", "Loans Awaiting 
Disbursal Summary by Month(Pen
 taho)"="Status: 503", "Loans Awaiting Disbursal Summary(Pentaho)"="Status: 
503", "Loans Awaiting Disbursal(Pentaho)"="Status: 503", "Loans Pending 
Approval"="Status: 403", "Loans Pending Approval(Pentaho)"="Status: 503", 
"Obligation Met Loans Details"="Status: 403", "Obligation Met Loans 
Details(Pentaho)"="Status: 503", "Obligation Met Loans Summary"="Status: 403", 
"Obligation Met Loans Summary(Pentaho)"="Status: 503", "Portfolio at 
Risk"="Status: 403", "Portfolio at Risk by Branch"="Status: 403", "Portfolio at 
Risk by Branch(Pentaho)"="Status: 503", "Portfolio at Risk(Pentaho)"="Status: 
503", "ProgramDetails"="Status: 403", "ProgramDirectorStats"="Status: 403", 
"ProgramStats"="Status: 403", "ReportCategoryList"="Status: 403", "Rescheduled 
Loans(Pentaho)"="Status: 503", "Savings Accounts Dormancy Report"="Status: 
403", "Savings Activated"="Status: 403", "Savings Deposit"="Status: 403", 
"Savings Rejected"="Status: 403", "Savings Transaction Receipt"="Status: 503", 
"Savings Transactio
 ns"="Status: 503", "Savings Withdrawal"="Status: 403", "Staff Assignment 
History"="Status: 503", "Trial Balance"="Status: 503", "Trial Balance Summary 
Report with Asset Owner"="Status: 403", "TxnRunningBalances(Pentaho)"="Status: 
503", "Written-Off Loans(Pentaho)"="Status: 503"}
         at 
app//org.apache.fineract.integrationtests.ReportExecutionIntegrationTest.verifyAllReportsExecution(ReportExecutionIntegrationTest.java:167)
   
     Test verifyLoanListingReport() PASSED (1.1s)
   
   FAILURE: Executed 3 tests in 29.9s (1 failed)
   
   
   3 tests completed, 1 failed
   
   > Task :integration-tests:test FAILED
   
   [Incubating] Problems report is available at: 
file:///C:/Users/shivd/Documents/mifos/fineract/build/reports/problems/problems-report.html
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':integration-tests:test'.
   > There were failing tests. See the report at: 
file:///C:/Users/shivd/Documents/mifos/fineract/integration-tests/build/reports/tests/test/index.html
   
   Deprecated Gradle features were used in this build, making it incompatible 
with Gradle 9.0.
   
   You can use '--warning-mode all' to show the individual deprecation warnings 
and determine if they come from your own scripts or plugins.
   
   For more on this, please refer to 
https://docs.gradle.org/8.14.3/userguide/command_line_interface.html#sec:command_line_warnings
 in the Gradle documentation.
   
   BUILD FAILED in 3m 30s
   98 actionable tasks: 6 executed, 92 up-to-date
   
   ```
   


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