-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19129: [ABFS] Test Fixes and Test Script Bug Fixes #6676
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 16 commits
24b35bd
d99c03f
d411eb0
1e13de2
0a54229
aaed50f
1c4c875
d304c7e
cb18c94
c1427b1
4868414
bf0e3fb
675f113
c899c90
86df633
c54a297
aa1acd3
abb6c11
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 |
|---|---|---|
|
|
@@ -18,8 +18,8 @@ | |
|
|
||
| See also: | ||
|
|
||
| * [ABFS](./abfs.html) | ||
| * [Testing](./testing_azure.html) | ||
| * [ABFS](./abfs.md) | ||
|
||
| * [Testing](./testing_azure.md) | ||
|
|
||
| ## Introduction | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -581,7 +581,7 @@ This will delete the containers; the output log of the test run will | |
| provide the details and summary of the operation. | ||
|
|
||
|
|
||
| ## Testing the Azure ABFS Client | ||
| # Testing the Azure ABFS Client | ||
|
|
||
| Azure Data Lake Storage Gen 2 (ADLS Gen 2) is a set of capabilities dedicated to | ||
| big data analytics, built on top of Azure Blob Storage. The ABFS and ABFSS | ||
|
|
@@ -602,29 +602,26 @@ various test combinations, it will: | |
| 2. Run tests for all combinations | ||
| 3. Summarize results across all the test combination runs. | ||
|
|
||
| Below are the pre-requiste steps to follow: | ||
| 1. Copy | ||
| Below are the pre-requisite steps to follow: | ||
| 1. Copy `./src/test/resources/azure-auth-keys.xml.template` to | ||
| `./src/test/resources/azure-auth-keys.xml` | ||
| 1. Update account names that should be used in the test run for HNS and non-HNS | ||
| combinations in the 2 properties present in the xml (account name should be | ||
| without domain part), namely | ||
| 1. `fs.azure.hnsTestAccountName`: Specify the HNS Enabled Account | ||
| 2. `fs.azure.nonHnsTestAccountName`: Specify the HNS Disabled Account | ||
|
|
||
| ./src/test/resources/azure-auth-keys.xml.template | ||
| TO | ||
| ./src/test/resources/azure-auth-keys.xml | ||
| Update account names that should be used in the test run for HNS and non-HNS | ||
| combinations in the 2 properties present in the xml (account name should be | ||
| without domain part), namely | ||
| Note: `azure-auth-keys.xml` is listed in .gitignore, so any accidental account name leak is prevented. | ||
|
|
||
| fs.azure.hnsTestAccountName | ||
| fs.azure.nonHnsTestAccountName | ||
| azure-auth-keys.xml is listed in .gitignore, so any accidental account name leak is prevented. | ||
| ``` | ||
| XInclude is supported, so for extra security secrets may be | ||
| kept out of the source tree then referenced through an XInclude element: | ||
|
|
||
| ``` | ||
| XInclude is supported, so for extra security secrets may be | ||
| kept out of the source tree then referenced through an XInclude element: | ||
|
|
||
| <include xmlns="http://www.w3.org/2001/XInclude" | ||
| href="/users/self/.secrets/auth-keys.xml" /> | ||
| ``` | ||
| <include xmlns="http://www.w3.org/2001/XInclude" | ||
| href="/users/self/.secrets/auth-keys.xml" /> | ||
| ``` | ||
|
|
||
| 2. Create account config files (one config file per account) in folder: | ||
| 1. Create account config files (one config file per account) in folder: | ||
|
|
||
| ./src/test/resources/accountSettings/ | ||
| Follow the instruction in the start of the template file | ||
|
|
@@ -634,6 +631,8 @@ kept out of the source tree then referenced through an XInclude element: | |
| New files created in folder accountSettings is listed in .gitignore to | ||
| prevent accidental cred leaks. | ||
|
|
||
| You are all set to run the test srcipt. | ||
|
||
|
|
||
| **To run PR validation:** Running command | ||
| * `dev-support/testrun-scripts/runtests.sh` will prompt as below: | ||
| ```bash | ||
|
|
@@ -664,6 +663,9 @@ Set the active test combination to run the action: | |
| 2) HNS-SharedKey 4) AppendBlob-HNS-OAuth 6) Quit | ||
| #? 1 | ||
|
|
||
| ============================================================ | ||
| HNS-OAuth | ||
| ============================================================ | ||
| Combination specific property setting: [ key=fs.azure.account.auth.type , value=OAuth ] | ||
|
|
||
| Activated [src/test/resources/abfs-combination-test-configs.xml] - for account: snvijayacontracttest for combination HNS-OAuth | ||
|
|
@@ -682,6 +684,46 @@ consolidated results of all the combination runs will be saved into a file as | |
| Test-Results.log in the same folder. When run for PR validation, the | ||
| consolidated test results needs to be pasted into the PR comment section. | ||
|
|
||
| **Aggregated Test Results**: `Test-Results.txt` file will show the aggregated results | ||
| across all th combinations ran as part of script in following format | ||
| ```bash | ||
| ============================================================ | ||
| HNS-OAuth | ||
| ============================================================ | ||
| [ERROR] testAbfsHttpSendStatistics(org.apache.hadoop.fs.azurebfs.ITestAbfsNetworkStatistics) Time elapsed: 3.137 s <<< FAILURE! | ||
| [ERROR] testBlobDataContributor(org.apache.hadoop.fs.azurebfs.ITestAzureBlobFileSystemOauth) Time elapsed: 4.154 s <<< ERROR! | ||
|
|
||
| [WARNING] Tests run: 137, Failures: 0, Errors: 0, Skipped: 2 | ||
| [ERROR] Tests run: 623, Failures: 1, Errors: 0, Skipped: 73 | ||
| [ERROR] Tests run: 340, Failures: 0, Errors: 1, Skipped: 55 | ||
|
|
||
| ============================================================ | ||
| HNS-SharedKey | ||
| ============================================================ | ||
| [ERROR] testAbfsHttpSendStatistics(org.apache.hadoop.fs.azurebfs.ITestAbfsNetworkStatistics) Time elapsed: 2.175 s <<< FAILURE! | ||
|
|
||
| [WARNING] Tests run: 137, Failures: 0, Errors: 0, Skipped: 3 | ||
| [ERROR] Tests run: 623, Failures: 1, Errors: 0, Skipped: 42 | ||
| [WARNING] Tests run: 340, Failures: 0, Errors: 0, Skipped: 41 | ||
|
|
||
| ============================================================ | ||
| NonHNS-SharedKey | ||
| ============================================================ | ||
| [ERROR] testNonRecursiveDeleteWithPagination(org.apache.hadoop.fs.azurebfs.services.ITestAbfsPaginatedDelete) Time elapsed: 0.85 s <<< ERROR! | ||
|
|
||
| [WARNING] Tests run: 137, Failures: 0, Errors: 0, Skipped: 9 | ||
| [ERROR] Tests run: 607, Failures: 1, Errors: 1, Skipped: 269 | ||
| [WARNING] Tests run: 340, Failures: 0, Errors: 0, Skipped: 44 | ||
|
|
||
| ============================================================ | ||
| AppendBlob-HNS-OAuth | ||
| ============================================================ | ||
|
|
||
| [WARNING] Tests run: 137, Failures: 0, Errors: 0, Skipped: 2 | ||
| [ERROR] Tests run: 623, Failures: 0, Errors: 0, Skipped: 73 | ||
| [ERROR] Tests run: 340, Failures: 0, Errors: 0, Skipped: 79 | ||
| ``` | ||
|
|
||
| **To add a new test combination:** Templates for mandatory test combinations | ||
| for PR validation are present in `dev-support/testrun-scripts/runtests.sh`. | ||
| If a new one needs to be added, add a combination to | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| import java.util.concurrent.Callable; | ||
|
|
||
| import org.junit.After; | ||
| import org.junit.Assume; | ||
| import org.junit.Before; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
@@ -106,18 +107,11 @@ protected AbstractAbfsIntegrationTest() throws Exception { | |
| abfsConfig = new AbfsConfiguration(rawConfig, accountName); | ||
|
|
||
| authType = abfsConfig.getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME, AuthType.SharedKey); | ||
| assumeValidAuthConfigsPresent(); | ||
|
|
||
| abfsScheme = authType == AuthType.SharedKey ? FileSystemUriSchemes.ABFS_SCHEME | ||
| : FileSystemUriSchemes.ABFS_SECURE_SCHEME; | ||
|
|
||
| if (authType == AuthType.SharedKey) { | ||
| assumeTrue("Not set: " + FS_AZURE_ACCOUNT_KEY, | ||
| abfsConfig.get(FS_AZURE_ACCOUNT_KEY) != null); | ||
| // Update credentials | ||
| } else { | ||
| assumeTrue("Not set: " + FS_AZURE_ACCOUNT_TOKEN_PROVIDER_TYPE_PROPERTY_NAME, | ||
| abfsConfig.get(FS_AZURE_ACCOUNT_TOKEN_PROVIDER_TYPE_PROPERTY_NAME) != null); | ||
| } | ||
|
|
||
| final String abfsUrl = this.getFileSystemName() + "@" + this.getAccountName(); | ||
| URI defaultUri = null; | ||
|
|
||
|
|
@@ -130,7 +124,7 @@ protected AbstractAbfsIntegrationTest() throws Exception { | |
| this.testUrl = defaultUri.toString(); | ||
| abfsConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultUri.toString()); | ||
| abfsConfig.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, true); | ||
| if (abfsConfig.get(FS_AZURE_TEST_APPENDBLOB_ENABLED) == "true") { | ||
| if (isAppendBlobEnabled()) { | ||
| String appendblobDirs = this.testUrl + "," + abfsConfig.get(FS_AZURE_CONTRACT_TEST_URI); | ||
| rawConfig.set(FS_AZURE_APPEND_BLOB_KEY, appendblobDirs); | ||
| } | ||
|
|
@@ -263,26 +257,28 @@ public AccessTokenProvider getAccessTokenProvider(final AzureBlobFileSystem fs) | |
| } | ||
|
|
||
| public void loadConfiguredFileSystem() throws Exception { | ||
| // disable auto-creation of filesystem | ||
| abfsConfig.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, | ||
| // disable auto-creation of filesystem | ||
| abfsConfig.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, | ||
| false); | ||
|
|
||
| // AbstractAbfsIntegrationTest always uses a new instance of FileSystem, | ||
| // need to disable that and force filesystem provided in test configs. | ||
| String[] authorityParts = | ||
| (new URI(rawConfig.get(FS_AZURE_CONTRACT_TEST_URI))).getRawAuthority().split( | ||
| AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER, 2); | ||
| this.fileSystemName = authorityParts[0]; | ||
| // AbstractAbfsIntegrationTest always uses a new instance of FileSystem, | ||
| // need to disable that and force filesystem provided in test configs. | ||
| assumeValidTestConfigPresent(this.getRawConfiguration(), FS_AZURE_CONTRACT_TEST_URI); | ||
|
|
||
| // Reset URL with configured filesystem | ||
| final String abfsUrl = this.getFileSystemName() + "@" + this.getAccountName(); | ||
| URI defaultUri = null; | ||
| String[] authorityParts = | ||
| (new URI(rawConfig.get(FS_AZURE_CONTRACT_TEST_URI))).getRawAuthority().split( | ||
| AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER, 2); | ||
| this.fileSystemName = authorityParts[0]; | ||
|
|
||
| defaultUri = new URI(abfsScheme, abfsUrl, null, null, null); | ||
| // Reset URL with configured filesystem | ||
| final String abfsUrl = this.getFileSystemName() + "@" + this.getAccountName(); | ||
| URI defaultUri = null; | ||
|
|
||
| this.testUrl = defaultUri.toString(); | ||
| abfsConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, | ||
| defaultUri.toString()); | ||
| defaultUri = new URI(abfsScheme, abfsUrl, null, null, null); | ||
|
|
||
| this.testUrl = defaultUri.toString(); | ||
| abfsConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, | ||
| defaultUri.toString()); | ||
|
|
||
| useConfiguredFileSystem = true; | ||
| } | ||
|
|
@@ -532,4 +528,36 @@ protected long assertAbfsStatistics(AbfsStatistic statistic, | |
| (long) metricMap.get(statistic.getStatName())); | ||
| return expectedValue; | ||
| } | ||
|
|
||
| protected void assumeValidTestConfigPresent(final Configuration conf, final String key) { | ||
| String configuredValue = conf.get(key); | ||
|
||
| Assume.assumeTrue(String.format("Missing Required Test Config: %s.", key), | ||
| configuredValue != null && !configuredValue.isEmpty()); | ||
| } | ||
|
|
||
| protected void assumeValidAuthConfigsPresent() { | ||
| final AuthType currentAuthType = getAuthType(); | ||
| Assume.assumeFalse( | ||
| "SAS Based Authentication Not Allowed For Integration Tests", | ||
| currentAuthType == AuthType.SAS); | ||
| if (currentAuthType == AuthType.SharedKey) { | ||
| assumeValidTestConfigPresent(getRawConfiguration(), FS_AZURE_ACCOUNT_KEY); | ||
| } else if (currentAuthType == AuthType.OAuth) { | ||
| assumeValidTestConfigPresent(getRawConfiguration(), | ||
| FS_AZURE_ACCOUNT_TOKEN_PROVIDER_TYPE_PROPERTY_NAME); | ||
| assumeValidTestConfigPresent(getRawConfiguration(), | ||
| FS_AZURE_ACCOUNT_OAUTH_CLIENT_ID); | ||
| assumeValidTestConfigPresent(getRawConfiguration(), | ||
| FS_AZURE_ACCOUNT_OAUTH_CLIENT_SECRET); | ||
| assumeValidTestConfigPresent(getRawConfiguration(), | ||
| FS_AZURE_ACCOUNT_OAUTH_CLIENT_ENDPOINT); | ||
| } else if (currentAuthType == AuthType.Custom) { | ||
| assumeValidTestConfigPresent(getRawConfiguration(), | ||
| FS_AZURE_ACCOUNT_TOKEN_PROVIDER_TYPE_PROPERTY_NAME); | ||
| } | ||
| } | ||
|
|
||
| protected boolean isAppendBlobEnabled() { | ||
| return getRawConfiguration().getBoolean(FS_AZURE_TEST_APPENDBLOB_ENABLED, false); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add a comment to explain what regex do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, Taken