Skip to content

Commit ff6c7c7

Browse files
committed
Merge branch '3.4.x'
2 parents 3239342 + 8502c80 commit ff6c7c7

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 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.
@@ -295,14 +295,23 @@ void skipSslValidation() {
295295
Object interceptorSecurityService = ReflectionTestUtils.getField(interceptor,
296296
"cloudFoundrySecurityService");
297297
WebClient webClient = (WebClient) ReflectionTestUtils.getField(interceptorSecurityService, "webClient");
298-
webClient.get()
298+
doesNotFailWithSslException(() -> webClient.get()
299299
.uri("https://self-signed.badssl.com/")
300300
.retrieve()
301301
.toBodilessEntity()
302-
.block(Duration.ofSeconds(30));
302+
.block(Duration.ofSeconds(30)));
303303
});
304304
}
305305

306+
private static void doesNotFailWithSslException(Runnable action) {
307+
try {
308+
action.run();
309+
}
310+
catch (RuntimeException ex) {
311+
assertThat(findCause(ex, SSLException.class)).isNull();
312+
}
313+
}
314+
306315
@Test
307316
void sslValidationNotSkippedByDefault() {
308317
this.contextRunner.withConfiguration(AutoConfigurations.of(HealthEndpointAutoConfiguration.class))
@@ -340,6 +349,16 @@ private WebOperation findOperationWithRequestPath(ExposableWebEndpoint endpoint,
340349
"No operation found with request path " + requestPath + " from " + endpoint.getOperations());
341350
}
342351

352+
private static <E extends Throwable> E findCause(Throwable failure, Class<E> type) {
353+
while (failure != null) {
354+
if (type.isInstance(failure)) {
355+
return type.cast(failure);
356+
}
357+
failure = failure.getCause();
358+
}
359+
return null;
360+
}
361+
343362
@Endpoint(id = "test")
344363
static class TestEndpoint {
345364

0 commit comments

Comments
 (0)