Skip to content

Commit 6ecc693

Browse files
HADOOP-19719. Wildfly Followup: TestDelegatingSSLSocketFactory (#8075) (#8071)
Downgrade to a skipped test if the attempting to create an openssl factory raises a wrapped NoSuchAlgorithmException; this is to avoid failures on test runs on RHEL8 VMs. Note: this branch-3.4 version preserves the test testJSEENoGCMJava8(). Contributed by Steve Loughran
1 parent 7ecf2c4 commit 6ecc693

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
package org.apache.hadoop.security.ssl;
2020

2121
import java.io.IOException;
22+
import java.security.NoSuchAlgorithmException;
2223
import java.util.Arrays;
2324

25+
import org.assertj.core.api.Assertions;
2426
import org.junit.Test;
2527

2628
import org.apache.hadoop.util.NativeCodeLoader;
@@ -34,15 +36,24 @@
3436
public class TestDelegatingSSLSocketFactory {
3537

3638
@Test
37-
public void testOpenSSL() throws IOException {
39+
public void testOpenSSL() {
3840
assumeTrue("Unable to load native libraries",
3941
NativeCodeLoader.isNativeCodeLoaded());
4042
assumeTrue("Build was not compiled with support for OpenSSL",
4143
NativeCodeLoader.buildSupportsOpenssl());
42-
DelegatingSSLSocketFactory.initializeDefaultFactory(
43-
DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL);
44-
assertThat(DelegatingSSLSocketFactory.getDefaultFactory()
45-
.getProviderName()).contains("openssl");
44+
try {
45+
DelegatingSSLSocketFactory.initializeDefaultFactory(
46+
DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL);
47+
assertThat(DelegatingSSLSocketFactory.getDefaultFactory()
48+
.getProviderName()).contains("openssl");
49+
} catch (IOException e) {
50+
// if this is caused by a wildfly version error, downgrade to an assume
51+
final Throwable cause = e.getCause();
52+
Assertions.assertThat(cause)
53+
.describedAs("Cause of %s: %s", e, cause)
54+
.isInstanceOf(NoSuchAlgorithmException.class);
55+
assumeTrue("wildfly library not compatible with this OS version", false);
56+
}
4657
}
4758

4859
@Test

0 commit comments

Comments
 (0)