Skip to content

Commit ad926a3

Browse files
author
Anuj Modi
committed
Updating Tests
1 parent ba947aa commit ad926a3

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemE2E.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_HTTP_READ_TIMEOUT;
4141
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_MAX_IO_RETRIES;
4242
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_TOLERATE_CONCURRENT_APPEND;
43+
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_ACCOUNT_IS_HNS_ENABLED;
4344
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertPathDoesNotExist;
4445
import static org.apache.hadoop.fs.contract.ContractTestUtils.assertPathExists;
4546
import static org.apache.hadoop.test.LambdaTestUtils.intercept;
@@ -259,6 +260,9 @@ public void testHttpReadTimeout() throws Exception {
259260

260261
public void testHttpTimeouts(int connectionTimeoutMs, int readTimeoutMs)
261262
throws Exception {
263+
// This is to make sure File System creation goes through before network calls start failing.
264+
assumeValidTestConfigPresent(this.getRawConfiguration(), FS_AZURE_ACCOUNT_IS_HNS_ENABLED);
265+
262266
Configuration conf = this.getRawConfiguration();
263267
// set to small values that will cause timeouts
264268
conf.setInt(AZURE_HTTP_CONNECTION_TIMEOUT, connectionTimeoutMs);

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestGetNameSpaceEnabled.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,27 +290,32 @@ public void testAccountSpecificConfig() throws Exception {
290290
String defaultUri2 = this.getTestUrl().replace(this.getAccountName(), accountName2);
291291
String defaultUri3 = this.getTestUrl().replace(this.getAccountName(), accountName3);
292292

293-
// Set account specific config for account 1
294-
rawConfig.set(accountProperty(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, accountName1), TRUE_STR);
293+
// Set both account specific and account agnostic config for account 1
294+
rawConfig.set(accountProperty(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, accountName1), FALSE_STR);
295+
rawConfig.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, TRUE_STR);
295296
rawConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultUri1);
296297
AzureBlobFileSystem fs1 = (AzureBlobFileSystem) FileSystem.newInstance(rawConfig);
298+
// Assert that account specific config takes precedence
299+
Assertions.assertThat(getIsNamespaceEnabled(fs1)).describedAs(
300+
"getIsNamespaceEnabled should return true when the "
301+
+ "account specific config is set as true").isFalse();
297302

298-
// Set account specific config for account 2
303+
// Set only the account specific config for account 2
299304
rawConfig.set(accountProperty(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, accountName2), FALSE_STR);
305+
rawConfig.unset(FS_AZURE_ACCOUNT_IS_HNS_ENABLED);
300306
rawConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultUri2);
301307
AzureBlobFileSystem fs2 = (AzureBlobFileSystem) FileSystem.newInstance(rawConfig);
308+
// Assert that account specific config is enough.
309+
Assertions.assertThat(getIsNamespaceEnabled(fs2)).describedAs(
310+
"getIsNamespaceEnabled should return true when the "
311+
+ "account specific config is set as true").isFalse();
302312

303-
// Set account agnostic config for account 3
313+
// Set only account agnostic config for account 3
304314
rawConfig.set(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, FALSE_STR);
315+
rawConfig.unset(accountProperty(FS_AZURE_ACCOUNT_IS_HNS_ENABLED, accountName3));
305316
rawConfig.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultUri3);
306317
AzureBlobFileSystem fs3 = (AzureBlobFileSystem) FileSystem.newInstance(rawConfig);
307-
308-
Assertions.assertThat(getIsNamespaceEnabled(fs1)).describedAs(
309-
"getIsNamespaceEnabled should return true when the "
310-
+ "account specific config is set as true").isTrue();
311-
Assertions.assertThat(getIsNamespaceEnabled(fs2)).describedAs(
312-
"getIsNamespaceEnabled should return true when the "
313-
+ "account specific config is set as true").isFalse();
318+
// Assert that account agnostic config is enough.
314319
Assertions.assertThat(getIsNamespaceEnabled(fs3)).describedAs(
315320
"getIsNamespaceEnabled should return true when the "
316321
+ "account specific config is not set").isFalse();

0 commit comments

Comments
 (0)