From 69931447b23123427249eb1496582b93d7dc6e22 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 10 Nov 2025 20:30:37 +0000 Subject: [PATCH 1/3] HADOOP-19719. Wildfly Followup: TestDelegatingSSLSocketFactory Downgrade to a skipped tests if the OS doesn't have GLIBC_2.34. Also cut testJSEENoGCMJava8() as this test will never run on java17. --- .../ssl/TestDelegatingSSLSocketFactory.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java index 844286fc15e36..3dc29c64e2bf5 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java @@ -19,12 +19,12 @@ package org.apache.hadoop.security.ssl; import java.io.IOException; -import java.util.Arrays; import org.junit.jupiter.api.Test; import org.apache.hadoop.util.NativeCodeLoader; +import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -39,19 +39,16 @@ public void testOpenSSL() throws IOException { "Unable to load native libraries"); assumeTrue(NativeCodeLoader.buildSupportsOpenssl(), "Build was not compiled with support for OpenSSL"); - DelegatingSSLSocketFactory.initializeDefaultFactory( - DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL); - assertThat(DelegatingSSLSocketFactory.getDefaultFactory() - .getProviderName()).contains("openssl"); + try { + DelegatingSSLSocketFactory.initializeDefaultFactory( + DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL); + assertThat(DelegatingSSLSocketFactory.getDefaultFactory() + .getProviderName()).contains("openssl"); + } catch (IOException e) { + // if this is caused by a wildfly version error, downgrade to an assume + assertExceptionContains("GLIBC_2.34", e); + assumeTrue(false, "wildfly library not compatible with this OS version"); + } } - @Test - public void testJSEENoGCMJava8() throws IOException { - assumeTrue(System.getProperty("java.version").startsWith("1.8"), - "Not running on Java 8"); - DelegatingSSLSocketFactory.initializeDefaultFactory( - DelegatingSSLSocketFactory.SSLChannelMode.Default_JSSE); - assertThat(Arrays.stream(DelegatingSSLSocketFactory.getDefaultFactory() - .getSupportedCipherSuites())).noneMatch("GCM"::contains); - } } From d1b7076e7a9e241a2a4aeb3e322cb1ddd80bb006 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Thu, 13 Nov 2025 14:48:23 +0000 Subject: [PATCH 2/3] HADOOP-19719. Don't look for text (too far down); just exception type. ...but do this down two levels --- .../ssl/TestDelegatingSSLSocketFactory.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java index 3dc29c64e2bf5..8d3a8439b0ab7 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java @@ -19,12 +19,13 @@ package org.apache.hadoop.security.ssl; import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.apache.hadoop.util.NativeCodeLoader; -import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -34,7 +35,7 @@ public class TestDelegatingSSLSocketFactory { @Test - public void testOpenSSL() throws IOException { + public void testOpenSSL() { assumeTrue(NativeCodeLoader.isNativeCodeLoaded(), "Unable to load native libraries"); assumeTrue(NativeCodeLoader.buildSupportsOpenssl(), @@ -46,7 +47,14 @@ public void testOpenSSL() throws IOException { .getProviderName()).contains("openssl"); } catch (IOException e) { // if this is caused by a wildfly version error, downgrade to an assume - assertExceptionContains("GLIBC_2.34", e); + final Throwable cause = e.getCause(); + Assertions.assertThat(cause) + .describedAs("Cause of %s: %s", e, cause) + .isInstanceOf(NoSuchAlgorithmException.class); + final Throwable innermost = cause.getCause(); + Assertions.assertThat(innermost) + .describedAs("Innermost Cause of %s: %s", e, innermost) + .isInstanceOf(UnsatisfiedLinkError.class); assumeTrue(false, "wildfly library not compatible with this OS version"); } } From b72c0fb68b9910877bc01b422a356ea96599fc75 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Fri, 14 Nov 2025 11:25:05 +0000 Subject: [PATCH 3/3] HADOOP-19719. cut back on exception chain asserts. Simply verify the IOE contains NoSuchAlgorithmException; no checking further down or looking for error text. Less brittle, though there's risk of other failures being missed. --- .../hadoop/security/ssl/TestDelegatingSSLSocketFactory.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java index 8d3a8439b0ab7..1a1787fca6590 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java @@ -51,10 +51,6 @@ public void testOpenSSL() { Assertions.assertThat(cause) .describedAs("Cause of %s: %s", e, cause) .isInstanceOf(NoSuchAlgorithmException.class); - final Throwable innermost = cause.getCause(); - Assertions.assertThat(innermost) - .describedAs("Innermost Cause of %s: %s", e, innermost) - .isInstanceOf(UnsatisfiedLinkError.class); assumeTrue(false, "wildfly library not compatible with this OS version"); } }