Skip to content

Commit 5475f10

Browse files
committed
Remove WebClient's in-memory buffer size limit for endpoint tests
Previously, the thread dump endpoint's response could exceed WebClient's in-memory buffer limt when there were a large number of threads or the threads had large stacks. This commit disables WebClient's in-memory buffer size limit so that the test passing is not dependent on the number of active threads and their stack sizes. Closes gh-22101
1 parent b273037 commit 5475f10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -192,7 +192,8 @@ private WebTestClient createWebTestClient() {
192192
DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(
193193
"http://localhost:" + determinePort());
194194
uriBuilderFactory.setEncodingMode(EncodingMode.NONE);
195-
return WebTestClient.bindToServer().uriBuilderFactory(uriBuilderFactory).responseTimeout(TIMEOUT).build();
195+
return WebTestClient.bindToServer().uriBuilderFactory(uriBuilderFactory).responseTimeout(TIMEOUT)
196+
.codecs((codecs) -> codecs.defaultCodecs().maxInMemorySize(-1)).build();
196197
}
197198

198199
private int determinePort() {

0 commit comments

Comments
 (0)