@@ -354,30 +354,64 @@ public void testAccountSpecificConfig() throws Exception {
354
354
*/
355
355
@ Test
356
356
public void testNameSpaceConfig () throws Exception {
357
- Configuration configuration = new Configuration ();
357
+ Configuration configuration = getRawConfiguration ();
358
358
configuration .unset (FS_AZURE_ACCOUNT_IS_HNS_ENABLED );
359
+ configuration .unset (accountProperty (FS_AZURE_ACCOUNT_IS_HNS_ENABLED , this .getAccountName ()));
360
+ AzureBlobFileSystem abfs = (AzureBlobFileSystem ) FileSystem .newInstance (configuration );
359
361
AbfsConfiguration abfsConfig = new AbfsConfiguration (configuration , "bogusAccountName" );
360
362
361
363
// Test that the namespace value when config is not set
362
364
Assertions .assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
363
365
.describedAs ("Namespace enabled should be unknown in case config is not set" )
364
366
.isEqualTo (Trilean .UNKNOWN );
365
367
368
+ // In case no namespace config is present, file system init calls getAcl() to determine account type.
369
+ Assertions .assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
370
+ .describedAs ("getIsNamespaceEnabled should return account type based on getAcl() call" )
371
+ .isEqualTo (abfs .getAbfsClient ().getIsNamespaceEnabled ());
372
+
373
+ // In case no namespace config is present, file system init calls getAcl() to determine account type.
374
+ Assertions .assertThat (abfs .getAbfsStore ().getAbfsConfiguration ().getIsNamespaceEnabledAccount ())
375
+ .describedAs ("getIsNamespaceEnabled() should return updated account type based on getAcl() call" )
376
+ .isNotEqualTo (Trilean .UNKNOWN );
377
+
366
378
configuration .set (FS_AZURE_ACCOUNT_IS_HNS_ENABLED , TRUE_STR );
379
+ abfs = (AzureBlobFileSystem ) FileSystem .newInstance (configuration );
367
380
abfsConfig = new AbfsConfiguration (configuration , "bogusAccountName" );
368
381
369
382
// Test that the namespace enabled config is set correctly
370
383
Assertions .assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
371
384
.describedAs ("Namespace enabled should be true in case config is set to true" )
372
385
.isEqualTo (Trilean .TRUE );
373
386
387
+ // In case namespace config is present, same value will be return.
388
+ Assertions .assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
389
+ .describedAs ("getIsNamespaceEnabled() should return true when config is set to true" )
390
+ .isEqualTo (true );
391
+
392
+ // In case namespace config is present, same value will be return.
393
+ Assertions .assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
394
+ .describedAs ("Client's getIsNamespaceEnabled() should return true when config is set to true" )
395
+ .isEqualTo (true );
396
+
374
397
configuration .set (FS_AZURE_ACCOUNT_IS_HNS_ENABLED , FALSE_STR );
398
+ abfs = (AzureBlobFileSystem ) FileSystem .newInstance (configuration );
375
399
abfsConfig = new AbfsConfiguration (configuration , "bogusAccountName" );
376
400
377
401
// Test that the namespace enabled config is set correctly
378
402
Assertions .assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
379
403
.describedAs ("Namespace enabled should be false in case config is set to false" )
380
404
.isEqualTo (Trilean .FALSE );
405
+
406
+ // In case namespace config is present, same value will be return.
407
+ Assertions .assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
408
+ .describedAs ("getIsNamespaceEnabled() should return false when config is set to false" )
409
+ .isEqualTo (false );
410
+
411
+ // In case namespace config is present, same value will be return.
412
+ Assertions .assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
413
+ .describedAs ("Client's getIsNamespaceEnabled() should return false when config is set to false" )
414
+ .isEqualTo (false );
381
415
}
382
416
383
417
private void assertFileSystemInitWithExpectedHNSSettings (
0 commit comments