micronaut-core
micronaut-core copied to clipboard
Do not set CLOUD environment for GitHub runners and/or any test environment
Feature description
We are starting to experiment with self-hosted GitHub runners and some tests are starting to fail because when running tests on GitHub Runners are hosts on EC2 therefore the CLOUD environment is deduced. From my point of view it would make sense not to deduce the additional environments within tests.
To get you into context, we are a having a couple of test/local implementations which are using @Requires(env = Environment.CLOUD) not to leak into production.
So are you expecting Micronaut to detect that it's running on a "CI environment", in which case, it won't set the CLOUD environment?
How would we detect that an application is running "on GitHub runners and/or any test environment"? Seems a scope too broad.
Indeed. I guess the most simplistic solution would be not to deduce additional environments once test environment is detected. At least the cloud ones.
You can disable it using deduceEnvironment: Micronaut.build().deduceEnvironment(false).run().
I think we are going to remove automatic deduction in V4.
thank you @dstepanov! is there something I can do for @MicronautTest test cases?
Ah right, you have a test... The other way would be to disable it using a system property