|
32 | 32 |
|
33 | 33 | import org.assertj.core.api.Assertions; |
34 | 34 | import org.junit.Test; |
35 | | -import org.mockito.Mock; |
36 | 35 | import org.mockito.Mockito; |
37 | 36 | import org.mockito.stubbing.Stubber; |
38 | 37 |
|
|
42 | 41 | import org.apache.hadoop.fs.FileStatus; |
43 | 42 | import org.apache.hadoop.fs.LocatedFileStatus; |
44 | 43 | import org.apache.hadoop.fs.Path; |
45 | | -import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType; |
46 | 44 | import org.apache.hadoop.fs.azurebfs.constants.FSOperationType; |
47 | 45 | import org.apache.hadoop.fs.azurebfs.constants.HttpHeaderConfigurations; |
48 | 46 | import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsDriverException; |
|
67 | 65 | import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.TRUE; |
68 | 66 | import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_LIST_MAX_RESULTS; |
69 | 67 | 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; |
71 | 68 | import static org.apache.hadoop.fs.azurebfs.services.AbfsErrors.ERR_BLOB_LIST_PARSING; |
72 | 69 | import static org.apache.hadoop.fs.azurebfs.services.RenameAtomicity.SUFFIX; |
73 | 70 | 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; |
74 | 72 | import static org.apache.hadoop.fs.azurebfs.services.RetryReasonConstants.CONNECTION_TIMEOUT_JDK_MESSAGE; |
75 | 73 | import static org.apache.hadoop.fs.contract.ContractTestUtils.assertMkdirs; |
76 | 74 | import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile; |
@@ -137,7 +135,9 @@ public Void call() throws Exception { |
137 | 135 |
|
138 | 136 | /** |
139 | 137 | * 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. |
141 | 141 | */ |
142 | 142 | @Test |
143 | 143 | public void testListPathTracingContext() throws Exception { |
@@ -167,6 +167,10 @@ public void testListPathTracingContext() throws Exception { |
167 | 167 | List<FileStatus> fileStatuses = new ArrayList<>(); |
168 | 168 | spiedStore.listStatus(new Path("/"), "", fileStatuses, true, null, spiedTracingContext); |
169 | 169 |
|
| 170 | + // Assert that there were retries due to SocketTimeoutException |
| 171 | + Mockito.verify(spiedClient, Mockito.times(1)) |
| 172 | + .getRetryPolicy(CONNECTION_TIMEOUT_ABBREVIATION); |
| 173 | + |
170 | 174 | // Assert that there were 2 paginated ListPath calls were made 1 and 2. |
171 | 175 | // 1. Without continuation token |
172 | 176 | Mockito.verify(spiedClient, times(1)).listPath( |
|
0 commit comments