Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Factory can't find standalone test resource in submodule w/IntelliJ #638

Open
MT-Jacobs opened this issue Jun 6, 2024 · 0 comments

Comments

@MT-Jacobs
Copy link
Contributor

Expected Behavior

Based on the comments I see in #312, it seems like the plan is that a .micronaut directory in the root of the project is supposed to control test resource configuration as a backup if the build tool isn't used to run your tests - such as when you run a single test in a file in IntelliJ.

Actual Behaviour

However, if you run your test resources in a separate module and use the test-resource-consumer plugin in the other modules, those modules will fail to find the test resource module if you run tests w/o delegating to gradle.

This happens because the .micronaut directory is found in the test resource module, not in the root project directory module.

This could possibly be fixed with some custom configuration that sets test-resource configuration instructions in the root directory that delegates to the proper module.

Alternatively, since your consuming projects have to set up a dependency on the test resource module -

testResourcesService(project(":test-resources"))

it might be possible to somehow check this dependency's contents to figure out the proper .micronaut directory location instead.

Steps To Reproduce

  1. Clone this example application listed below.
  2. Run RedisCacheTest using gradle
  3. Run the single test in RedisCacheTest using something like IntelliJ - this won't delegate to gradle and will instead use the IntelliJ runner.

In the first test, environment variables get set correctly.
In the second test, there are no environment variables, and the application module isn't aware of the test-resources/.micronaut/test-resources directory in the test-resources module.

Environment Information

Ran this locally w/ Mac OSX.
Uses JDK 17

Example Application

https://github.com/MT-Jacobs/mn-test-resource-module

Version

4.4.3

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

No branches or pull requests

1 participant