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

Provide method for QuarkusTestResourceLifecycleManagers to get current config values or know what profile is running #22074

Closed
GregJohnStewart opened this issue Dec 9, 2021 · 5 comments · Fixed by #22180
Labels
area/testing kind/enhancement New feature or request
Milestone

Comments

@GregJohnStewart
Copy link
Contributor

Description

Lifecyfle managers can need to spin up different services in different ways for different test profiles.

Currently, the only way for the QuarkusTestResourceLifecycleManager to know how setup resources from one test to another are through initArgs. This works, but has a couple flaws:

  • requires arg to be set for every test class of different profiles
  • makes for very long-winded annotations, even for single flags

If QuarkusTestResourceLifecycleManager had a way to access at bare minimum what profile is currently running, or even had access to preliminary configs, it would eliminate the need for all the extra annotations.

Implementation ideas

Just throwing ideas out, but concerning the start() method;

Instead of returning values to override config, what if the start() method takes as a parameter the current configMap: start(Map<String, String> configMap). This would allow for both overrides to that map and for the manager to glean information about what profile might be running and what needs started up.

Or just add a method or member to QuarkusTestResourceLifecycleManager that takes the current config/ running test profile that makes it available to implementations.

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 9, 2021

/cc @geoand

@famod
Copy link
Member

famod commented Dec 9, 2021

I think I've just run into a similar problem with @EnumSource; the manager would need to know which enum is selected.
OTOH this is not really related to "config", so it's a bit different.

@geoand
Copy link
Contributor

geoand commented Dec 10, 2021

I see where this is coming from, but I don't really see a way to implement it properly.

@GregJohnStewart
Copy link
Contributor Author

If we could just get some context form what is running, say the current profile, that would work for me... I'm not read into the flow of this but I might assume that in the context of where init() for the lifecycle manager is called, the annotations of the test class are reachable, and therefore the test profile that we are currently running.

geoand added a commit to geoand/quarkus that referenced this issue Dec 14, 2021
This allows implementations to take different actions based on the
profile they are being used with.

Closes: quarkusio#22074
@geoand
Copy link
Contributor

geoand commented Dec 14, 2021

#22180 should provide the bare minimum for this, i.e. the QuarkusTestResourceLifecycleManager can now know the name of the profile it's running in

geoand added a commit to geoand/quarkus that referenced this issue Dec 14, 2021
This allows implementations to take different actions based on the
profile they are being used with.

Closes: quarkusio#22074
geoand added a commit to geoand/quarkus that referenced this issue Dec 14, 2021
This allows implementations to take different actions based on the
profile they are being used with.

Closes: quarkusio#22074
@quarkus-bot quarkus-bot bot added this to the 2.7 - main milestone Dec 15, 2021
geoand added a commit that referenced this issue Dec 15, 2021
Introduce context awareness into QuarkusTestResourceLifecycleManager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants