Skip to content

ReactorResourceFactory is not restarted properly when ApplicationContext is resumed by TestContext Framework #35585

@kzander91

Description

@kzander91

Spring Boot 4.0.0-M3
Spring Framework 7.0.0-M9

I'm not sure if this is an issue with Boot or Framework (or both).

As of Framework 7, the Spring Test Context Framework will suspend cached application contexts when they're no longer being used by tests, and restarted when the next test uses them again.
It appears that some beans don't fully support this, at least the embedded web server and the reactor resource factory.
When multiple test classes share the same context (due to identical context configurations), after the first test is done, the embedded server and the reactor resource factory are shut down, butwhen the next test retrieves the context from the cache, they're not started again.

This reproducer demonstrates this: demo5.zip

It has three groups of test classes with two tests each, sharing a context between them.
Two test groups use WebTestClient to call the embedded server (on the defined or on a random port). The second test in each group fails each time because the server is not running.
The third test group uses WebClient to call the embedded server. The second test in the group fails due to the event loop being shut down and not accepting tasks.

Note that each test succeeds when executed individually, but tests start to fail when we start all tests at once.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions