Merge branch '3.4.x'

This commit is contained in:
Stéphane Nicoll 2025-01-07 10:30:41 +01:00
commit ff6c7c7fdf
1 changed files with 22 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -295,14 +295,23 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
Object interceptorSecurityService = ReflectionTestUtils.getField(interceptor, Object interceptorSecurityService = ReflectionTestUtils.getField(interceptor,
"cloudFoundrySecurityService"); "cloudFoundrySecurityService");
WebClient webClient = (WebClient) ReflectionTestUtils.getField(interceptorSecurityService, "webClient"); WebClient webClient = (WebClient) ReflectionTestUtils.getField(interceptorSecurityService, "webClient");
webClient.get() doesNotFailWithSslException(() -> webClient.get()
.uri("https://self-signed.badssl.com/") .uri("https://self-signed.badssl.com/")
.retrieve() .retrieve()
.toBodilessEntity() .toBodilessEntity()
.block(Duration.ofSeconds(30)); .block(Duration.ofSeconds(30)));
}); });
} }
private static void doesNotFailWithSslException(Runnable action) {
try {
action.run();
}
catch (RuntimeException ex) {
assertThat(findCause(ex, SSLException.class)).isNull();
}
}
@Test @Test
void sslValidationNotSkippedByDefault() { void sslValidationNotSkippedByDefault() {
this.contextRunner.withConfiguration(AutoConfigurations.of(HealthEndpointAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(HealthEndpointAutoConfiguration.class))
@ -340,6 +349,16 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
"No operation found with request path " + requestPath + " from " + endpoint.getOperations()); "No operation found with request path " + requestPath + " from " + endpoint.getOperations());
} }
private static <E extends Throwable> E findCause(Throwable failure, Class<E> type) {
while (failure != null) {
if (type.isInstance(failure)) {
return type.cast(failure);
}
failure = failure.getCause();
}
return null;
}
@Endpoint(id = "test") @Endpoint(id = "test")
static class TestEndpoint { static class TestEndpoint {