Skip to content

Commit 5df635d

Browse files
committed
Test Enhancements
1 parent f968baa commit 5df635d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import org.assertj.core.api.Assertions;
3434
import org.junit.Test;
35-
import org.mockito.Mock;
3635
import org.mockito.Mockito;
3736
import org.mockito.stubbing.Stubber;
3837

@@ -42,7 +41,6 @@
4241
import org.apache.hadoop.fs.FileStatus;
4342
import org.apache.hadoop.fs.LocatedFileStatus;
4443
import org.apache.hadoop.fs.Path;
45-
import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType;
4644
import org.apache.hadoop.fs.azurebfs.constants.FSOperationType;
4745
import org.apache.hadoop.fs.azurebfs.constants.HttpHeaderConfigurations;
4846
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsDriverException;
@@ -67,10 +65,10 @@
6765
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.TRUE;
6866
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_LIST_MAX_RESULTS;
6967
import static org.apache.hadoop.fs.azurebfs.constants.HttpHeaderConfigurations.X_MS_METADATA_PREFIX;
70-
import static org.apache.hadoop.fs.azurebfs.contracts.services.AzureServiceErrorCode.COPY_BLOB_ABORTED;
7168
import static org.apache.hadoop.fs.azurebfs.services.AbfsErrors.ERR_BLOB_LIST_PARSING;
7269
import static org.apache.hadoop.fs.azurebfs.services.RenameAtomicity.SUFFIX;
7370
import static org.apache.hadoop.fs.azurebfs.services.RetryReasonConstants.CONNECTION_RESET_MESSAGE;
71+
import static org.apache.hadoop.fs.azurebfs.services.RetryReasonConstants.CONNECTION_TIMEOUT_ABBREVIATION;
7472
import static org.apache.hadoop.fs.azurebfs.services.RetryReasonConstants.CONNECTION_TIMEOUT_JDK_MESSAGE;
7573
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertMkdirs;
7674
import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
@@ -137,7 +135,9 @@ public Void call() throws Exception {
137135

138136
/**
139137
* Test to verify that each paginated call to ListBlobs uses a new tracing context.
140-
* @throws Exception
138+
* Test also verifies that the retry policy is called when a SocketTimeoutException
139+
* Test also verifies that empty list with valid continuation token is handled.
140+
* @throws Exception if there is an error or test assertions fails.
141141
*/
142142
@Test
143143
public void testListPathTracingContext() throws Exception {
@@ -167,6 +167,10 @@ public void testListPathTracingContext() throws Exception {
167167
List<FileStatus> fileStatuses = new ArrayList<>();
168168
spiedStore.listStatus(new Path("/"), "", fileStatuses, true, null, spiedTracingContext);
169169

170+
// Assert that there were retries due to SocketTimeoutException
171+
Mockito.verify(spiedClient, Mockito.times(1))
172+
.getRetryPolicy(CONNECTION_TIMEOUT_ABBREVIATION);
173+
170174
// Assert that there were 2 paginated ListPath calls were made 1 and 2.
171175
// 1. Without continuation token
172176
Mockito.verify(spiedClient, times(1)).listPath(

0 commit comments

Comments
 (0)