grpc-ecosystem / grpc-ecosystem/grpc-spring
`@DirtiesContext` is required on every test
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
**The context**
The need for `@DirtiesContext` on all unit tests using a grpc service created by this starter greatly slows down tests, and doesn't feel like a proper solution as applications scale.
**The bug**
What's the problem? What's not working? What do you expect to happen.
all `@SpringBootTest` classes also require `@DirtiesContext` in order for tests across the application to function propertly.
Is there a stacktrace or a hint in the logs? (very important)
Screenshots work as well, but don't screenshot your logs.
**Steps to Reproduce**
Steps to reproduce the behavior:
1. Create an application using gRPC services.
2. Write 2 or more `@SpringBootTest` classes
3. Run your project's tests. These test classes will compete and your tests will fail.
Workaround, add `@DirtiesContext` to each test, but, this greatly slows down execution time of your application tests.
**The application's environment**
Which versions do you use?
* Spring (boot):
* grpc-java:
* grpc-spring-boot-starter:
* java: version + architecture (64bit?)
* Other relevant libraries...
These versions don't really matter - it's a core issue with this library that is seemingly well documented, but there has to be a better way?
**Additional context**
* Did it ever work before?
No
* Do you have a demo?
No, but this issue is seemingly well documented with this project, but `@DirtiesContext` feels like a workaround instead of a solution.
Contributor guide
Research direction
Start by reproducing the issue with two or more @SpringBootTest classes using gRPC services, then inspect how the test application context and gRPC service are managed between tests. Done means the tests no longer compete or fail across classes without requiring @DirtiesContext on every test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java, spring-boot
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100