|
29 | 29 | import org.apache.hadoop.fs.CommonConfigurationKeysPublic; |
30 | 30 | import org.apache.hadoop.fs.FileSystem; |
31 | 31 | import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType; |
32 | | -import org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys; |
33 | 32 | import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsRestOperationException; |
34 | 33 | import org.apache.hadoop.fs.azurebfs.services.AbfsClient; |
35 | 34 | import org.apache.hadoop.fs.azurebfs.services.AbfsDfsClient; |
@@ -283,6 +282,9 @@ private void ensureGetAclDetermineHnsStatusAccuratelyInternal(int statusCode, |
283 | 282 | boolean isHnsEnabled = store.getIsNamespaceEnabled( |
284 | 283 | getTestTracingContext(getFileSystem(), false)); |
285 | 284 | Assertions.assertThat(isHnsEnabled).isEqualTo(expectedValue); |
| 285 | + Assertions.assertThat(store.getClient().getIsNamespaceEnabled()) |
| 286 | + .describedAs("ABFS Client should return same isNameSpace value as store") |
| 287 | + .isEqualTo(expectedValue); |
286 | 288 |
|
287 | 289 | // GetAcl() should be called only once to determine the HNS status. |
288 | 290 | Mockito.verify(mockClient, times(1)) |
@@ -344,57 +346,33 @@ public void testAccountSpecificConfig() throws Exception { |
344 | 346 |
|
345 | 347 | /** |
346 | 348 | * Tests the behavior of AbfsConfiguration when the namespace-enabled |
347 | | - * configuration is not explicitly set (i.e., set to an empty string). |
| 349 | + * configuration set based on config provided. |
348 | 350 | * |
349 | | - * Expects the namespace value to be set as UNKNOWN. |
| 351 | + * Expects the namespace value based on config provided. |
350 | 352 | * |
351 | 353 | * @throws Exception if any error occurs during configuration setup or evaluation |
352 | 354 | */ |
353 | 355 | @Test |
354 | | - public void testNameSpaceConfigNotSet() throws Exception { |
| 356 | + public void testNameSpaceConfig() throws Exception { |
355 | 357 | Configuration configuration = new Configuration(); |
356 | | - configuration.set(ConfigurationKeys.FS_AZURE_ACCOUNT_IS_HNS_ENABLED, ""); |
| 358 | + configuration.unset(FS_AZURE_ACCOUNT_IS_HNS_ENABLED); |
357 | 359 | AbfsConfiguration abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName"); |
358 | 360 |
|
359 | | - // Test that the namespace enabled config is set correctly |
| 361 | + // Test that the namespace value when config is not set |
360 | 362 | Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount()) |
361 | 363 | .describedAs("Namespace enabled should be unknown in case config is not set") |
362 | 364 | .isEqualTo(Trilean.UNKNOWN); |
363 | | - } |
364 | 365 |
|
365 | | - /** |
366 | | - * Tests the behavior of AbfsConfiguration when the namespace-enabled |
367 | | - * configuration is explicitly set to "true". |
368 | | - * |
369 | | - * Expects the namespace value to be set as TRUE. |
370 | | - * |
371 | | - * @throws Exception if any error occurs during configuration setup or evaluation |
372 | | - */ |
373 | | - @Test |
374 | | - public void testNameSpaceConfigSetToTrue() throws Exception { |
375 | | - Configuration configuration = new Configuration(); |
376 | | - configuration.set(ConfigurationKeys.FS_AZURE_ACCOUNT_IS_HNS_ENABLED, "true"); |
377 | | - AbfsConfiguration abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName"); |
| 366 | + configuration.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, TRUE_STR); |
| 367 | + abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName"); |
378 | 368 |
|
379 | 369 | // Test that the namespace enabled config is set correctly |
380 | 370 | Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount()) |
381 | 371 | .describedAs("Namespace enabled should be true in case config is set to true") |
382 | 372 | .isEqualTo(Trilean.TRUE); |
383 | | - } |
384 | 373 |
|
385 | | - /** |
386 | | - * Tests the behavior of AbfsConfiguration when the namespace-enabled |
387 | | - * configuration is explicitly set to "false". |
388 | | - * |
389 | | - * Expects the namespace value to be set as FALSE. |
390 | | - * |
391 | | - * @throws Exception if any error occurs during configuration setup or evaluation |
392 | | - */ |
393 | | - @Test |
394 | | - public void testNameSpaceConfigSetToFalse() throws Exception { |
395 | | - Configuration configuration = new Configuration(); |
396 | | - configuration.set(ConfigurationKeys.FS_AZURE_ACCOUNT_IS_HNS_ENABLED, "false"); |
397 | | - AbfsConfiguration abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName"); |
| 374 | + configuration.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, FALSE_STR); |
| 375 | + abfsConfig = new AbfsConfiguration(configuration, "bogusAccountName"); |
398 | 376 |
|
399 | 377 | // Test that the namespace enabled config is set correctly |
400 | 378 | Assertions.assertThat(abfsConfig.getIsNamespaceEnabledAccount()) |
|
0 commit comments