From 3a8f9a5f665a8a56cadc46fd5c28507e26d62c6f Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 13 Nov 2023 13:59:24 -0600 Subject: [PATCH] fix test expectation --- .../xpack/ssl/SslClientAuthenticationTests.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/ssl/SslClientAuthenticationTests.java b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/ssl/SslClientAuthenticationTests.java index 038bb9c2c0079..bc01b0693af0a 100644 --- a/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/ssl/SslClientAuthenticationTests.java +++ b/x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/ssl/SslClientAuthenticationTests.java @@ -31,6 +31,7 @@ import java.nio.file.Path; import java.security.SecureRandom; import java.security.cert.CertPathBuilderException; +import java.security.cert.CertificateException; import java.util.HashSet; import java.util.List; @@ -103,11 +104,13 @@ public void testThatHttpFailsWithoutSslClientAuth() throws IOException { restClient.performRequest(new Request("GET", "/")); fail("Expected SSLHandshakeException"); } catch (IOException e) { - Throwable t = ExceptionsHelper.unwrap(e, CertPathBuilderException.class); - assertThat(t, instanceOf(CertPathBuilderException.class)); if (inFipsJvm()) { + Throwable t = ExceptionsHelper.unwrap(e, CertificateException.class); + assertThat(t, instanceOf(CertificateException.class)); assertThat(t.getMessage(), containsString("Unable to find certificate chain")); } else { + Throwable t = ExceptionsHelper.unwrap(e, CertPathBuilderException.class); + assertThat(t, instanceOf(CertPathBuilderException.class)); assertThat(t.getMessage(), containsString("unable to find valid certification path to requested target")); } }