-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Hadoop-16438 ADLS Gen1 OpenSSL config control #1394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0ae56da
5af9306
92d4cdc
73c75a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
|
|
||
| package org.apache.hadoop.fs.adl.live; | ||
|
|
||
| import com.microsoft.azure.datalake.store.SSLSocketFactoryEx.SSLChannelMode; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.fs.adl.AdlFileSystem; | ||
| import org.junit.Assert; | ||
|
|
@@ -29,6 +30,7 @@ | |
| import java.net.URISyntaxException; | ||
|
|
||
| import static org.apache.hadoop.fs.adl.AdlConfKeys.ADL_HTTP_TIMEOUT; | ||
| import static org.apache.hadoop.fs.adl.AdlConfKeys.ADL_SSL_CHANNEL_MODE; | ||
|
|
||
| /** | ||
| * Tests interactions with SDK and ensures configuration is having the desired | ||
|
|
@@ -53,7 +55,6 @@ public void testDefaultTimeout() throws IOException { | |
|
|
||
| // Skip this test if we can't get a real FS | ||
| Assume.assumeNotNull(fs); | ||
|
|
||
| effectiveTimeout = fs.getAdlClient().getDefaultTimeout(); | ||
| Assert.assertFalse("A negative timeout is not supposed to take effect", | ||
| effectiveTimeout < 0); | ||
|
|
@@ -74,4 +75,67 @@ public void testDefaultTimeout() throws IOException { | |
|
|
||
| // The default value may vary by SDK, so that value is not tested here. | ||
| } | ||
|
|
||
| @Test | ||
| public void testSSLChannelMode() throws IOException { | ||
snvijaya marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| AdlFileSystem fs = null; | ||
| Configuration conf = null; | ||
|
|
||
| conf = AdlStorageConfiguration.getConfiguration(); | ||
| conf.set(ADL_SSL_CHANNEL_MODE, "OpenSSl"); | ||
snvijaya marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| try { | ||
| fs = (AdlFileSystem) | ||
| (AdlStorageConfiguration.createStorageConnector(conf)); | ||
| } catch (URISyntaxException e) { | ||
|
||
| throw new IllegalStateException("ADL FileSystem initialization failed. " | ||
| + "Please check test.fs.adl.name property.", e); | ||
| } | ||
|
|
||
| SSLChannelMode sslChannelMode = fs.getAdlClient().getSSLChannelMode(); | ||
| Assert.assertTrue("Channel mode needs to be OpenSSL", | ||
|
||
| sslChannelMode == SSLChannelMode.OpenSSL); | ||
|
|
||
| conf = AdlStorageConfiguration.getConfiguration(); | ||
| conf.set(ADL_SSL_CHANNEL_MODE, "Default_JSE"); | ||
| try { | ||
| fs = (AdlFileSystem) | ||
| (AdlStorageConfiguration.createStorageConnector(conf)); | ||
| } catch (URISyntaxException e) { | ||
| throw new IllegalStateException("Can not initialize ADL FileSystem. " | ||
| + "Please check test.fs.adl.name property.", e); | ||
| } | ||
|
|
||
| sslChannelMode = fs.getAdlClient().getSSLChannelMode(); | ||
| Assert.assertTrue("Channel mode needs to be Default_JSE", | ||
| sslChannelMode == SSLChannelMode.Default_JSE); | ||
|
|
||
| conf = AdlStorageConfiguration.getConfiguration(); | ||
| conf.set(ADL_SSL_CHANNEL_MODE, "Default"); | ||
| try { | ||
| fs = (AdlFileSystem) | ||
| (AdlStorageConfiguration.createStorageConnector(conf)); | ||
| } catch (URISyntaxException e) { | ||
| throw new IllegalStateException("Can not initialize ADL FileSystem. " | ||
| + "Please check test.fs.adl.name property.", e); | ||
| } | ||
|
|
||
| sslChannelMode = fs.getAdlClient().getSSLChannelMode(); | ||
| Assert.assertTrue("Channel mode needs to be Default", | ||
| sslChannelMode == SSLChannelMode.Default); | ||
|
|
||
| conf = AdlStorageConfiguration.getConfiguration(); | ||
| conf.set(ADL_SSL_CHANNEL_MODE, "Invalid"); | ||
| try { | ||
| fs = (AdlFileSystem) | ||
| (AdlStorageConfiguration.createStorageConnector(conf)); | ||
| } catch (URISyntaxException e) { | ||
| throw new IllegalStateException("Can not initialize ADL FileSystem. " | ||
| + "Please check test.fs.adl.name property.", e); | ||
| } | ||
|
|
||
| sslChannelMode = fs.getAdlClient().getSSLChannelMode(); | ||
| Assert.assertTrue("Channel mode needs to be Default when adl.ssl" | ||
snvijaya marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + ".channel.mode config is missing or is invalid", | ||
| sslChannelMode == SSLChannelMode.Default); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.