spring-cloud / spring-cloud/spring-cloud-netflix
Ribbon integration keeps reference to "old" ApplicationContexts even when using @DirtiesContext on Undertow
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5k
- Forks
- 2.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 10
Description
The ApplicationContext used by HttpClientRibbonCommandFactory of RibbonRoutingFilter does not seem to be refreshed by the @DirtiesContext annotation on SpringBoot tests.
This causes tests using @DirtiesContext to fail because all tests with a "dirty" context are trying to used an inactive and closed ApplicationContext, which means that this exception is thrown: https://github.com/spring-projects/spring-framework/blob/v4.3.4.RELEASE/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java#L1065
Now, it does not exactly sound like a cause that @DirtiesContext should be able to handle out of the box (though it'd be nice). What would be the best way to refresh the HttpClientRibbonCommandFactory of a RibbonRoutingFilter across test runs?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with HttpClientRibbonCommandFactory and RibbonRoutingFilter in the Undertow test setup, then reproduce the failure across Spring Boot test runs using @DirtiesContext. Trace where the factory retains the ApplicationContext and verify the behavior against the closed-context exception. Done means dirty contexts no longer cause tests to use an inactive ApplicationContext.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, 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