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

Can not run parallel test with Spring boot 3 and AOT #2686

Closed
ntthaibk opened this issue Jan 26, 2023 · 1 comment · Fixed by #2687
Closed

Can not run parallel test with Spring boot 3 and AOT #2686

ntthaibk opened this issue Jan 26, 2023 · 1 comment · Fixed by #2687

Comments

@ntthaibk
Copy link
Contributor

ntthaibk commented Jan 26, 2023

👓 What did you see?

Please refer to this Sample Github Repo
When I run the test in parallel with mvn clean test without provide the -Dgroups for maven surefire plugins, the test is run smoothly, but when I do. running the test with mvn clean test -Dgroups=DEBUG it run into a racing condition and throw java.lang.IllegalArgumentException: AOT attributes cannot be overridden. Name '[org.springframework.boot.test.context.SpringBootTestContextBootstrapper.SpringBootConfiguration.com](http://org.springframework.boot.test.context.springboottestcontextbootstrapper.springbootconfiguration.com/).mdaq.testing.api.ApplicationTests' is already in use.

✅ What did you expect to see?

The test can run in parallel when providing tags

📦 Which tool/library version are you using?

  • I'm using JDK 17 + Spring boot 3.0.1 with cucumber 7.10.1 and JUnit 5.9.2

🔬 How could we reproduce it?

Sample Github Repo

Steps to reproduce the behavior:

clone the sample github repo
run mvn clean test -Dgroups=DEBUG couple of time and the issue will show up

📚 Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

@mpkorstanje mpkorstanje changed the title can not run parallel test with Spring boot 3 when provide -Dgroups Can not run parallel test with Spring boot 3 Jan 27, 2023
@mpkorstanje mpkorstanje changed the title Can not run parallel test with Spring boot 3 Can not run parallel test with Spring boot 3 and AOT Jan 27, 2023
@mpkorstanje
Copy link
Contributor

In brief, the problem is that invoking new TestContextManager(someContextConfiguration) for identical instances of someContextConfiguration is not actually thread-safe. Spring caches the configuration derived from someContextConfiguration and when AOT is used, will fail to apply idempotent updates configuration .

It's not quite clear to me why -Dgroups=DEBUG is essential to reproducing the problem.

mpkorstanje added a commit that referenced this issue Jan 27, 2023
In brief, the problem is that invoking `new TestContextManager(someContextConfiguration)`
for identical instances of someContextConfiguration is not actually
thread-safe. Spring caches the configuration derived from `someContextConfiguration`
and when AOT is used, will fail to apply idempotent updates configuration.

Fixes: #2686

Co-authored-by: M.P. Korstanje <rien.korstanje@gmail.com>
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

Successfully merging a pull request may close this issue.

2 participants