bhattmanish98 commented on code in PR #7817:
URL: https://github.com/apache/hadoop/pull/7817#discussion_r2280769103


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java:
##########
@@ -869,4 +874,217 @@ private void testIsNonEmptyDirectoryInternal(String 
firstCT,
         .listPath(eq("/testPath"), eq(false), eq(1),
             any(), any(TracingContext.class), any());
   }
+
+  /**
+   * Test to verify that the KeepAliveCache is initialized with the correct 
number of connections.
+   * This test is applicable only for ApacheHttpClient.
+   */
+  @Test
+  public void testKeepAliveCacheInitializationWithApacheHttpClient() throws 
Exception {
+    Assume.assumeTrue(APACHE_HTTP_CLIENT == httpOperationType);
+    final AzureBlobFileSystem fs = this.getFileSystem();
+    AbfsClientHandler abfsClientHandler = fs.getAbfsStore().getClientHandler();
+
+    AbfsClient dfsClient = abfsClientHandler.getDfsClient();
+    AbfsClient blobClient = abfsClientHandler.getBlobClient();
+
+    checkKacOnBothClientsAfterFSInit(dfsClient);
+    checkKacOnBothClientsAfterFSInit(blobClient);
+  }
+
+  /**
+   * Test to verify the behavior of stale connections in the KeepAliveCache.
+   * This test is applicable only for ApacheHttpClient.
+   */
+  @Test
+  public void testStaleConnectionBehavior() throws Exception {
+    Assume.assumeTrue(APACHE_HTTP_CLIENT == httpOperationType);
+    Configuration conf = this.getFileSystem().getConf();
+
+    // This is to avoid actual metric calls during the test
+    conf.unset(FS_AZURE_METRIC_ACCOUNT_NAME);
+
+    // Initialize the file system
+    AzureBlobFileSystemStore store = this.getFileSystem(conf).getAbfsStore();
+    AbfsClientHandler abfsClientHandler = store.getClientHandler();
+
+    AbfsClient dfsClient = abfsClientHandler.getDfsClient();
+    AbfsClient blobClient = abfsClientHandler.getBlobClient();
+
+    checkKacOnBothClientsAfterFSInit(dfsClient);
+    checkKacOnBothClientsAfterFSInit(blobClient);
+
+    // Wait for 5 minutes to make the cached connections stale

Review Comment:
   During POC we found out this timeout time.



-- 
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.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to