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

Property value from context is unexpected when run junit tests in parallel (context corrupted?) #34339

Open
verusikk opened this issue Jan 29, 2025 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@verusikk
Copy link

Description
Integration tests in a Spring Boot application run in parallel and set a variable using @DynamicPropertySource. Each test is expected to start its own Spring context with separate beans and properties, but properties value is unexpectedly overwritten by other tests.

Reproducer
A small reproducer for the issue has been prepared: GitHub Repository (Java 21, Kotlin, Gradle).

During execution, each test launches a Spring Batch job, passing the assigned parameter value. The job then verifies that this value matches the one in its context. When tests run in parallel, some of them fail because the expected and actual values do not match.

However, when running tests sequentially (without parallelization), all tests pass successfully.

What was tried

  • set property with @TestPropertySource for each test
  • use different value for @ActiveProfiles for each test

How to reproduce
Clone https://github.com/verusikk/spring-boot-integration-tests-issue, use README.md commands to run integration tests.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

2 participants