adamsaghy commented on PR #6311:
URL: https://github.com/apache/fineract/pull/6311#issuecomment-6610857872
@oluexpert99 Thanks for the rebase. One thing still needs fixing before this
can be merged.
`testTellerFinancialActivityAccountCanBeUpdated` creates a `CASH_AT_TELLER`
mapping, but only one mapping per financial activity is allowed.
`AllocateCashToCashierValidationTest` creates `CASH_AT_MAINVAULT` and
`CASH_AT_TELLER` mappings in its `@BeforeAll` and never deletes them. If both
classes run against the same server and the cashier test runs first,
`createMapping(102, ...)` returns 403 (duplicate mapping) and the new test
fails.
In CI the two classes are currently in different shards, so the build
passes. They will end up in the same shard in a full local
`:integration-tests:test` run, or once test classes are added and the shard
split moves.
Please make `AllocateCashToCashierValidationTest` delete the mappings it
created, the same way `AccountTransferTest` does. Something like this:
```java
private final List<Long> createdFinancialActivityAccountIds = new
ArrayList<>();
@BeforeAll
public void ensureCashierFinancialActivityAccountsExist() {
// ... as now, but collect the ids:
ensureFinancialActivityAccountMapping(financialActivityAccountHelper,
accountHelper, FinancialActivity.CASH_AT_MAINVAULT.getValue())
.ifPresent(createdFinancialActivityAccountIds::add);
ensureFinancialActivityAccountMapping(financialActivityAccountHelper,
accountHelper, FinancialActivity.CASH_AT_TELLER.getValue())
.ifPresent(createdFinancialActivityAccountIds::add);
}
// return Optional.empty() when the mapping already exists, otherwise
Optional.of(createMapping(...).getResourceId())
@AfterAll
public void deleteCreatedFinancialActivityAccounts() {
final FeignFinancialActivityAccountHelper
financialActivityAccountHelper = new
FeignFinancialActivityAccountHelper(fineractClient());
createdFinancialActivityAccountIds.forEach(financialActivityAccountHelper::deleteMapping);
}
```
It only deletes the mappings this class created, so a mapping that existed
before it ran is left alone. Please run `./gradlew spotlessApply` before you
push.
--
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]