Closed npiguet closed 4 months ago
this is definitely a bug and unfortunate behaviour //cc @alvarosanchez @melix
Running mvn mn:start-testresources-service
in a separate terminal before mn:run
works around the problem. That mechanism works as expected
I have identified the problem, hoping to have a fix soon.
Expected Behavior
When my webapp is recompiled due to a change in the code, my application and all the containers it depends on are restarted. Then my application works as expected.
Ideally, to save some time, the test containers are never shut down and not restarted either (oracle is really slow to start).
Actual Behaviour
When my webapp is recompiled due to a change in the code, it restarts. However all the containers started by Micronaut test resources are shut down and never restarted, causing the application to fail to start
Steps To Reproduce
INFO] 📝 Detected change in src/main/resources/application-test.yml. Recompiling/restarting... [INFO] [info] Shutting down Micronaut Test Resources service
I've done a but of debugging, and it looks like this is caused by
mn:run
callingmvn compile
in a different process when it detects changes to the watched directories. When that happens the newmvn compile
runs as expected, but before terminating hitsTestResourcesLifecycleExtension.afterSessionEnd()
, which unconditionally stops the test resources service.As far as I can tell, nothing in either process restarts it.
I would personally love it if it DID NOT shut down the test containers at all.
Environment Information
JDK 17 Ubuntu 22.04 Micronaut 4.4.2 micronaut-maven-plugin 4.5.3