Skip to content

FINERACT-2455: Pin the business date in savings interest posting job tests - #6422

Open
oleksii-novikov-onix wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/savings-interest-posting-business-date
Open

FINERACT-2455: Pin the business date in savings interest posting job tests#6422
oleksii-novikov-onix wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/savings-interest-posting-business-date

Conversation

@oleksii-novikov-onix

@oleksii-novikov-onix oleksii-novikov-onix commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

The tests in SavingsInterestPostingJobIntegrationTest build their accounts on fixed 2022 dates (10 April, 21 June, 01 July). But four of them ran the "Post Interest For Savings" job without setting a business date, and one set it to Utils.getLocalDateOfTenant(). When enable-business-date is off, the business date falls back to the tenant's today, so the job posted interest from 2022 up to the real current date.

That is slow and it gets slower. For the April account the job walks about 1600 daily posting periods today, and one more every day.

It is also fragile. The job processes every ACTIVE savings account in the tenant, not only ours. SavingsSchedularInterestPoster.postInterest() is all or nothing per batch: if one account throws, batchUpdate() is skipped and no account in that batch gets its transactions. PostInterestForSavingTasklet.checkCompletion() only logs the error and the tasklet still returns RepeatStatus.FINISHED, so the job reports success and the test fails later on a short transaction list. A wider posting window means more work per batch and more chances to hit this.

Which accounts share the database is not stable either. scripts/split-tests.sh sorts all eligible test classes and splits them by NR % total_shards (15 shards, same for mysql, postgresql and mariadb). Adding one test class anywhere shifts every class after it into the next shard, so this class gets new neighbours. A clock-driven, tenant-wide job can therefore pass for a long time and then break in a branch that only added an unrelated test.

Fix: pin the business date. POSTING_JOB_BUSINESS_DATE = 31 July 2022 sits past every fixture in the class (last account starts on 01 July, last asserted posting is on 10 July), and every test that runs the job now goes through businessDateHelper.runAt(...). The submittedOnDate check compares against that date instead of today. The posting window drops from ~1600 days to 112.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • 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 for verifying the changes made.
  • Follow our 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
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

Your assigned reviewer(s) will follow our guidelines for code reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant