Skip to content

Commit c443d1d

Browse files
committed
HADOOP-19719. Wildfly Followup: TestDelegatingSSLSocketFactory
Downgrade to a skipped tests if the OS doesn't have GLIBC_2.34. The branch-3.4 version of the patch doesn't delete testJSEENoGCMJava8() and uses classic junit assumeTrue() calls.
1 parent 38f9c1c commit c443d1d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.apache.hadoop.util.NativeCodeLoader;
2727

28+
import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
2829
import static org.assertj.core.api.Assertions.assertThat;
2930
import static org.junit.Assume.assumeTrue;
3031

@@ -35,23 +36,30 @@ public class TestDelegatingSSLSocketFactory {
3536

3637
@Test
3738
public void testOpenSSL() throws IOException {
38-
assumeTrue("Unable to load native libraries",
39-
NativeCodeLoader.isNativeCodeLoaded());
40-
assumeTrue("Build was not compiled with support for OpenSSL",
41-
NativeCodeLoader.buildSupportsOpenssl());
42-
DelegatingSSLSocketFactory.initializeDefaultFactory(
43-
DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL);
44-
assertThat(DelegatingSSLSocketFactory.getDefaultFactory()
45-
.getProviderName()).contains("openssl");
39+
assumeTrue(NativeCodeLoader.isNativeCodeLoaded(),
40+
"Unable to load native libraries");
41+
assumeTrue(NativeCodeLoader.buildSupportsOpenssl(),
42+
"Build was not compiled with support for OpenSSL");
43+
try {
44+
DelegatingSSLSocketFactory.initializeDefaultFactory(
45+
DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL);
46+
assertThat(DelegatingSSLSocketFactory.getDefaultFactory()
47+
.getProviderName()).contains("openssl");
48+
} catch (IOException e) {
49+
// if this is caused by a wildfly version error, downgrade to an assume
50+
assertExceptionContains("GLIBC_2.34", e);
51+
assumeTrue(false, "wildfly library not compatible with this OS version");
52+
}
4653
}
4754

4855
@Test
4956
public void testJSEENoGCMJava8() throws IOException {
50-
assumeTrue("Not running on Java 8",
51-
System.getProperty("java.version").startsWith("1.8"));
57+
assumeTrue(System.getProperty("java.version").startsWith("1.8"),
58+
"Not running on Java 8");
5259
DelegatingSSLSocketFactory.initializeDefaultFactory(
5360
DelegatingSSLSocketFactory.SSLChannelMode.Default_JSSE);
5461
assertThat(Arrays.stream(DelegatingSSLSocketFactory.getDefaultFactory()
5562
.getSupportedCipherSuites())).noneMatch("GCM"::contains);
5663
}
64+
5765
}

0 commit comments

Comments
 (0)