I have integration tests running locally at least as reliably as they
appear to run on GitHub. Maybe I was the only one struggling to achieve
this, but I figure it can't hurt to share what I've learned. Much of what
I've learned has already been added to the top-level readme and more will
be added assuming PR #4612 <https://github.com/apache/fineract/pull/4612> (
FINERACT-2269 <https://issues.apache.org/jira/browse/FINERACT-2269> )
passes muster.

I've attached something that isn't appropriate to commit: a marked up and
oft-hacked shell script I use and the Docker Compose config file it uses to
start the db and an activemq broker that is apparently also required. These
come in very handy for me any time I want to race GitHub actions, get a 2nd
opinion on test results, or test commits before I push them. These are not
clean, not plug-and-play, and likely require a bunch of tweaking to use at
all.

One cool part (to me, anyway) is that now I don't have to do any env
tweaking, except for JAVA_HOME. Oh there's also that mysterious TZ override
that seems to help. Argh. Oh well. Still, way better than the 20-ish lines
of env var overrides I was previously using.

One thing I'm getting is increased confidence to be able to someday
recommend the Gradle daemon. It seems to work quite well so far.

You'll notice I have the aggressive cleanup steps commented out. I'm not
sure if/when those are necessary, but I use them sometimes to try to more
closely emulate what you'd get from a "fresh vm".

Old-timers might recall the ramdisk trick from (cough) *fifteen years ago*.
Here's to the good old days! 😃 Using a ramdisk speeds up some tests that
hit the db but surely not those that aren't CPU-bound. They seem to mostly
do a lot of waiting.

See also:

   - https://lists.apache.org/thread/6oj9gn2fwc41d2o8moddb8gjxxnqc5wd
   - https://groups.google.com/g/mifosdeveloper/c/qxZPBWDLpaM
   - https://groups.google.com/g/mifosdeveloper/c/MfAQcWxOmS0
   - https://mifosforge.jira.com/wiki/spaces/MIFOS/pages/5275914/RAMDisk

On Fri, Jan 31, 2025 at 12:29 PM Adam Monsen <amon...@mifos.org> wrote:

> Hi Petri!
>
> When the integration tests start cargo for Fineract, they provide a
>> specific set of configurations for Tomcat that configure Fineract into the
>> correct security mode for testing - see e.g the cargo config block in
>> fineract/oauth2-tests/build.gradle. Did you start your standalone server
>> with the same configs?
>>
>
> Yes, well, I tried to. It seems like there's still some runtime difference
> I was unable to account for. See the growing list of environment variables
> I shared earlier in this thread (inline
> <https://lists.apache.org/thread/343f01c4c0o1dfz45z219gn8cfxfqord> and
> attached
> <https://lists.apache.org/thread/2vrb64lhgscc4n3yw97o55ttqxz2lodj> as
> env.sh
> <https://lists.apache.org/api/email.lua?attachment=true&id=2vrb64lhgscc4n3yw97o55ttqxz2lodj&file=a510c3d82cc0629a5968dd05a49453272b71af812b1fa0137418402989904981>
> ).
>
> I don't think there's much of a gap if someone wants to remove cargo
> entirely, just need to resolve the activemq/spring jms conflict to fix the
> 16 failing tests. Probably.
>
> I'm not familiar with the issues you brought up around security tests
> needing cargo.
>
> I talked with Aleks about replacing the integration test cargo bits with,
> e.g. a local Fineract instance running in Docker. Seems like that's a good
> way to go.
>
> Related / asides:
>
> The current best source of how to test Fineract from the command line is
> the files in .github/workflows/ . It's too bad these *only* work on
> GitHub as written. I'll propose some updates to "INSTRUCTIONS: How to
> execute Integration Tests" in the top-level README.md file since what's
> there now is incorrect.
>
> Assuming those .github/workflows/ files are the most current and useful
> working description of a full build & test run, it's stunning to me that it
> could take an individual a full workday to reproduce that at home!
>
> For testing from IntelliJ, https://fineract-academy.com is the most
> current and useful.
>
> Best and thanks,
> -Adam
>

Attachment: integration-tests.sh
Description: application/shellscript

Attachment: fineract-test-compose.yml
Description: application/yaml

Reply via email to