manika137 commented on code in PR #7765:
URL: https://github.com/apache/hadoop/pull/7765#discussion_r2191366709


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestGetNameSpaceEnabled.java:
##########
@@ -341,6 +349,135 @@ public void testAccountSpecificConfig() throws Exception {
     }
   }
 
+  /**
+   * Tests the behavior of AbfsConfiguration when the namespace-enabled
+   * configuration set based on config provided.
+   *
+   * Expects the namespace value based on config provided.
+   *
+   * @throws Exception if any error occurs during configuration setup or 
evaluation
+   */
+  @Test
+  public void testNameSpaceConfig() throws Exception {
+    Configuration configuration = getConfigurationWithoutHnsConfig();
+    AzureBlobFileSystem abfs = (AzureBlobFileSystem) 
FileSystem.newInstance(configuration);
+    AbfsConfiguration abfsConfig = new AbfsConfiguration(configuration, 
"bogusAccountName");
+
+    // Test that the namespace value when config is not set
+    Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount())
+        .describedAs("Namespace enabled should be unknown in case config is 
not set")
+        .isEqualTo(Trilean.UNKNOWN);
+
+    // In case no namespace config is present, file system init calls getAcl() 
to determine account type.
+    
Assertions.assertThat(abfs.getIsNamespaceEnabled(getTestTracingContext(abfs, 
false)))
+        .describedAs("getIsNamespaceEnabled should return account type based 
on getAcl() call")
+        .isEqualTo(abfs.getAbfsClient().getIsNamespaceEnabled());
+
+    // In case no namespace config is present, file system init calls getAcl() 
to determine account type.
+    
Assertions.assertThat(abfs.getAbfsStore().getAbfsConfiguration().getIsNamespaceEnabledAccount())
+        .describedAs("getIsNamespaceEnabled() should return updated account 
type based on getAcl() call")
+        .isNotEqualTo(Trilean.UNKNOWN);
+
+    configuration.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, TRUE_STR);
+    abfs = (AzureBlobFileSystem) FileSystem.newInstance(configuration);
+    abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName");
+
+    // Test that the namespace enabled config is set correctly
+    Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount())
+        .describedAs("Namespace enabled should be true in case config is set 
to true")
+        .isEqualTo(Trilean.TRUE);
+
+    // In case namespace config is present, same value will be return.
+    
Assertions.assertThat(abfs.getIsNamespaceEnabled(getTestTracingContext(abfs, 
false)))
+        .describedAs("getIsNamespaceEnabled() should return true when config 
is set to true")
+        .isEqualTo(true);
+
+    // In case namespace config is present, same value will be return.
+    Assertions.assertThat(abfs.getAbfsClient().getIsNamespaceEnabled())
+        .describedAs("Client's getIsNamespaceEnabled() should return true when 
config is set to true")
+        .isEqualTo(true);
+
+    configuration.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, FALSE_STR);
+    abfs = (AzureBlobFileSystem) FileSystem.newInstance(configuration);
+    abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName");
+
+    // Test that the namespace enabled config is set correctly
+    Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount())
+        .describedAs("Namespace enabled should be false in case config is set 
to false")
+        .isEqualTo(Trilean.FALSE);
+
+    // In case namespace config is present, same value will be return.
+    
Assertions.assertThat(abfs.getIsNamespaceEnabled(getTestTracingContext(abfs, 
false)))
+        .describedAs("getIsNamespaceEnabled() should return false when config 
is set to false")
+        .isEqualTo(false);
+
+    // In case namespace config is present, same value will be return.
+    Assertions.assertThat(abfs.getAbfsClient().getIsNamespaceEnabled())
+        .describedAs("Client's getIsNamespaceEnabled() should return false 
when config is set to false")
+        .isEqualTo(false);
+  }
+
+  /**
+   * Tests to check that the namespace configuration is set correctly
+   * during the initialization of the AzureBlobFileSystem.
+   *
+   *
+   * @throws Exception if any error occurs during configuration setup or 
evaluation
+   */
+  @Test
+  public void testFsInitShouldSetNamespaceConfig() throws Exception {
+    // Mock the AzureBlobFileSystem and its dependencies
+    AzureBlobFileSystem mockFileSystem = Mockito.spy((AzureBlobFileSystem)

Review Comment:
   semicolon missed I think and spacing in next line



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