Skip to content

DirtiesContext used with Webflux, a random port and multiple contexts causes multiple contexts to misbehave #38199

@Dodomix

Description

@Dodomix

Bug description

I'm having an issue while running tests using Webflux. Tests are set up to run on a random port and access a controller using HttpClient (I've tested and the same issue happens with WebTestClient). If there are multiple application contexts used for the tests, then @DirtiesContext annotation causes contexts not being cleared to misbehave (to stop allowing connections).

Bug reproduce

Here is the simplest dummy app I've managed to build which replicates the issue: https://github.com/Dodomix/multiple-test-contexts-bug. If you run Test1 -> Test2 -> Test3, Test3 will fail. Each test by itself passes.

Expected behavior

All tests pass.

System info

Java: Temurin 17.0.9

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions