mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish d22969ae
The current threads must be retrieved each time so that we can see the keep-alive thread dying. See gh-37736
This commit is contained in:
parent
d13d38a141
commit
9897576562
@ -1421,15 +1421,12 @@ class SpringApplicationTests {
|
||||
application.setWebApplicationType(WebApplicationType.NONE);
|
||||
application.setKeepAlive(true);
|
||||
this.context = application.run();
|
||||
Set<Thread> threadsBeforeClose = getCurrentThreads();
|
||||
assertThat(threadsBeforeClose).filteredOn((thread) -> thread.getName().equals("keep-alive")).isNotEmpty();
|
||||
assertThat(getCurrentThreads()).filteredOn((thread) -> thread.getName().equals("keep-alive")).isNotEmpty();
|
||||
this.context.close();
|
||||
Set<Thread> threadsAfterClose = getCurrentThreads();
|
||||
Awaitility.await()
|
||||
.atMost(Duration.ofSeconds(30))
|
||||
.untilAsserted(
|
||||
() -> assertThat(threadsAfterClose).filteredOn((thread) -> thread.getName().equals("keep-alive"))
|
||||
.isEmpty());
|
||||
.untilAsserted(() -> assertThat(getCurrentThreads())
|
||||
.filteredOn((thread) -> thread.getName().equals("keep-alive")));
|
||||
}
|
||||
|
||||
private <S extends AvailabilityState> ArgumentMatcher<ApplicationEvent> isAvailabilityChangeEventWithState(
|
||||
|
Loading…
Reference in New Issue
Block a user