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
This commit is contained in:
Andy Wilkinson 2020-06-25 09:11:24 +01:00
parent b27303704f
commit 5475f10657

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -192,7 +192,8 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory(
"http://localhost:" + determinePort());
uriBuilderFactory.setEncodingMode(EncodingMode.NONE);
return WebTestClient.bindToServer().uriBuilderFactory(uriBuilderFactory).responseTimeout(TIMEOUT).build();
return WebTestClient.bindToServer().uriBuilderFactory(uriBuilderFactory).responseTimeout(TIMEOUT)
.codecs((codecs) -> codecs.defaultCodecs().maxInMemorySize(-1)).build();
}
private int determinePort() {