DadanielZ commented on a change in pull request #1697: Hadoop 16660: ABFS: Make
RetryCount in ExponentialRetryPolicy Configurable
URL: https://github.com/apache/hadoop/pull/1697#discussion_r344979662
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsRestOperationException.java
##########
@@ -72,4 +75,40 @@ public void testAbfsRestOperationExceptionFormat() throws
IOException {
&& errorFields[5].contains("Time"));
}
}
+
+ @Test
+ public void testRequestRetryConfig() throws Exception {
+ testRetryLogic(0);
+ testRetryLogic(3);
+ }
+
+ public void testRetryLogic(int numOfRetries) throws Exception {
+ AzureBlobFileSystem fs = this.getFileSystem();
+
+ Configuration config = new Configuration(this.getRawConfiguration());
+ String accountName = config.get("fs.azure.abfs.account.name");
+ // Setup to configure custom token provider
+ config.set("fs.azure.account.auth.type." + accountName, "Custom");
+ config.set("fs.azure.account.oauth.provider.type." + accountName,
"org.apache.hadoop.fs"
+ + ".azurebfs.oauth2.RetryTestTokenProvider");
+ config.set("fs.azure.io.retry.max.retries",
Integer.toString(numOfRetries));
+ // Stop filesystem creation as it will lead to calls to store.
+ config.set("fs.azure.createRemoteFileSystemDuringInitialization", "false");
+
+ fs = (AzureBlobFileSystem) FileSystem.newInstance(fs.getUri(), config);
+ RetryTestTokenProvider.ResetStatusToFirstTokenFetch();
+
+ try {
+ fs.getFileStatus(new Path("/"));
+ } catch (Exception ex) {
Review comment:
it is not guaranteed there is always exception.
Use "org.apache.hadoop.test.LambdaTestUtils.intercept" for exception check.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]