Skip to content

Commit dc2f22e

Browse files
committed
restop test review comments
1 parent 4071216 commit dc2f22e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsRestOperationException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ public void testWithDifferentCustomTokenFetchRetry(int numOfRetries) throws Exce
122122
});
123123

124124
// Number of retries done should be as configured
125-
Assert.assertTrue(
126-
"Number of token fetch retries (" + retryTestTokenProvider.getReTryCount()
127-
+ ") done, does not match with fs.azure.custom.token.fetch.retry.count configured (" + numOfRetries
128-
+ ")", retryTestTokenProvider.getReTryCount() == numOfRetries);
125+
Assert.assertEquals(
126+
"Number of token fetch retries done does not match with fs.azure"
127+
+ ".custom.token.fetch.retry.count configured", numOfRetries,
128+
retryTestTokenProvider.getRetryCount());
129129
}
130130

131131
@Test

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/oauth2/RetryTestTokenProvider.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,29 @@ public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
3535

3636
// Need to track first token fetch otherwise will get counted as a retry too.
3737
private boolean isThisFirstTokenFetch = true;
38-
private int reTryCount = 0;
38+
private int retryCount = 0;
3939

4040
@Override
4141
public void initialize(Configuration configuration, String accountName)
4242
throws IOException {
4343

4444
}
4545

46+
/**
47+
* Clear earlier retry details and reset RetryTestTokenProvider instance to
48+
* state of first access token fetch call
49+
*/
4650
public void resetStatusToFirstTokenFetch() {
4751
isThisFirstTokenFetch = true;
48-
reTryCount = 0;
52+
retryCount = 0;
4953
}
5054

5155
@Override
5256
public String getAccessToken() throws IOException {
5357
if (isThisFirstTokenFetch) {
5458
isThisFirstTokenFetch = false;
5559
} else {
56-
reTryCount++;
60+
retryCount++;
5761
}
5862

5963
LOG.debug("RetryTestTokenProvider: Throw an exception in fetching tokens");
@@ -70,7 +74,7 @@ public static RetryTestTokenProvider getCurrentRetryTestProviderInstance(
7074
return (RetryTestTokenProvider) ((CustomTokenProviderAdapter) customTokenProvider).getCustomTokenProviderAdaptee();
7175
}
7276

73-
public int getReTryCount() {
74-
return reTryCount;
77+
public int getRetryCount() {
78+
return retryCount;
7579
}
7680
}

0 commit comments

Comments
 (0)