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

Do not create new instances in nested tests #24172

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

Sgitario
Copy link
Contributor

@Sgitario Sgitario commented Mar 8, 2022

Fix #23947
Fix #20114

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 8, 2022

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)
  • title should not start with chore/docs/feat/fix/refactor but be a proper sentence

This message is automatically generated by a bot.

@Sgitario Sgitario changed the title fix: do not create new instances in nested tests Tests: do not create new instances in nested tests Mar 8, 2022
@gsmet gsmet requested a review from geoand March 8, 2022 13:45
@gsmet
Copy link
Member

gsmet commented Mar 8, 2022

@geoand I'll let you decide if this needs to be backported.

@geoand
Copy link
Contributor

geoand commented Mar 8, 2022

I'll need to look at this closer, because I think there is more to it than this...

@geoand
Copy link
Contributor

geoand commented Mar 8, 2022

@Sgitario can you explain this change please?

@Sgitario
Copy link
Contributor Author

Sgitario commented Mar 8, 2022

@Sgitario can you explain this change please?

In this line, a new instance of the outer class was being created to invoke the "before" methods (beforeEach for example). The right instance of the outer class was the one created at

outerInstance = runningQuarkusApplication.instance(outerClass);
.

Therefore, after using the right outer instance, when running the test, the instance will contain the data set at the beforeEach method.

@geoand
Copy link
Contributor

geoand commented Mar 8, 2022

Okay, thanks

@geoand
Copy link
Contributor

geoand commented Mar 8, 2022

Please also see the bot's comment about the title

@Sgitario
Copy link
Contributor Author

Sgitario commented Mar 8, 2022

Please also see the bot's comment about the title

Yes, I renamed the PR title just after I saw the comment.

@geoand geoand added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Mar 8, 2022
@geoand
Copy link
Contributor

geoand commented Mar 8, 2022

Actually, the title is not correct. We don't prefix the titles with the area the fix affects

@Sgitario Sgitario changed the title Tests: do not create new instances in nested tests Do not create new instances in nested tests Mar 8, 2022
@famod famod force-pushed the fix_junit5_nested branch from b08a00e to f34c7d5 Compare March 8, 2022 22:18
@famod
Copy link
Member

famod commented Mar 8, 2022

CI results looked very weird, so I rebased this to get a fresh run.

Edit: CI is still wonky.

@Sgitario Sgitario force-pushed the fix_junit5_nested branch from f34c7d5 to a66f993 Compare March 9, 2022 06:12
@geoand geoand merged commit 07cc8d4 into quarkusio:main Mar 9, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Mar 9, 2022
@quarkus-bot quarkus-bot bot added kind/bugfix and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Mar 9, 2022
@Sgitario Sgitario deleted the fix_junit5_nested branch March 9, 2022 11:00
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.5.Final Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants