From 5475f10657d1e4a3e9d819728ef1db6d0550f5b8 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 25 Jun 2020 09:11:24 +0100 Subject: [PATCH] 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 --- .../web/test/WebEndpointTestInvocationContextProvider.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java index 41bf39c07fa..68c8e401ed9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java @@ -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() {