From dc9c3ce30b9e043ef8e6c0d4d2faa185ffdefb4f Mon Sep 17 00:00:00 2001 From: Masatake Iwasaki Date: Wed, 20 Feb 2019 22:00:57 +0900 Subject: [PATCH] HADOOP-16104. Wasb tests to downgrade to skip when test a/c is namespace enabled. Contributed by Masatake Iwasaki. (cherry picked from commit aa3ad3660506382884324c4b8997973f5a68e29a) --- .../hadoop/fs/azure/AzureBlobStorageTestAccount.java | 3 +++ .../fs/azure/contract/NativeAzureFileSystemContract.java | 1 + .../hadoop/fs/azure/integration/AzureTestUtils.java | 9 +++++++++ .../hadoop-azure/src/test/resources/azure-test.xml | 5 +++++ hadoop-tools/hadoop-azure/src/test/resources/wasb.xml | 7 ++++++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/AzureBlobStorageTestAccount.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/AzureBlobStorageTestAccount.java index b65ce78fcbb..816a3af7f3b 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/AzureBlobStorageTestAccount.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/AzureBlobStorageTestAccount.java @@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.azure.integration.AzureTestConstants; import org.apache.hadoop.fs.azure.metrics.AzureFileSystemInstrumentation; import org.apache.hadoop.fs.azure.metrics.AzureFileSystemMetricsSystem; +import org.apache.hadoop.fs.azure.integration.AzureTestUtils; import org.apache.hadoop.metrics2.AbstractMetric; import org.apache.hadoop.metrics2.MetricsRecord; import org.apache.hadoop.metrics2.MetricsSink; @@ -529,6 +530,8 @@ public final class AzureBlobStorageTestAccount implements AutoCloseable, static CloudStorageAccount createTestAccount(Configuration conf) throws URISyntaxException, KeyProviderException { + AzureTestUtils.assumeNamespaceDisabled(conf); + String testAccountName = verifyWasbAccountNameInConfig(conf); if (testAccountName == null) { LOG.warn("Skipping live Azure test because of missing test account"); diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/contract/NativeAzureFileSystemContract.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/contract/NativeAzureFileSystemContract.java index a264acabc54..ea90a86dc05 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/contract/NativeAzureFileSystemContract.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/contract/NativeAzureFileSystemContract.java @@ -34,6 +34,7 @@ public class NativeAzureFileSystemContract extends AbstractBondedFSContract { public NativeAzureFileSystemContract(Configuration conf) { super(conf); //insert the base features addConfResource(CONTRACT_XML); + AzureTestUtils.assumeNamespaceDisabled(conf); } @Override diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java index c46320a4835..bc19700708b 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java @@ -47,6 +47,7 @@ import static org.junit.Assume.assumeTrue; import static org.apache.hadoop.fs.azure.AzureBlobStorageTestAccount.WASB_ACCOUNT_NAME_DOMAIN_SUFFIX_REGEX; import static org.apache.hadoop.fs.azure.AzureBlobStorageTestAccount.WASB_TEST_ACCOUNT_NAME_WITH_DOMAIN; import static org.apache.hadoop.fs.azure.integration.AzureTestConstants.*; +import static org.apache.hadoop.fs.azurebfs.constants.TestConfigurationKeys.FS_AZURE_TEST_NAMESPACE_ENABLED_ACCOUNT; import static org.apache.hadoop.test.MetricsAsserts.getLongCounter; import static org.apache.hadoop.test.MetricsAsserts.getLongGauge; import static org.apache.hadoop.test.MetricsAsserts.getMetrics; @@ -545,4 +546,12 @@ public final class AzureTestUtils extends Assert { inputStream.close(); return new String(buffer, 0, count); } + + /** + * Assume hierarchical namespace is disabled for test account. + */ + public static void assumeNamespaceDisabled(Configuration conf) { + Assume.assumeFalse("Hierarchical namespace is enabled for test account.", + conf.getBoolean(FS_AZURE_TEST_NAMESPACE_ENABLED_ACCOUNT, false)); + } } diff --git a/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml b/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml index a36a391cd56..24d444a88d7 100644 --- a/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml +++ b/hadoop-tools/hadoop-azure/src/test/resources/azure-test.xml @@ -28,6 +28,11 @@ false + + fs.azure.test.namespace.enabled + false + + diff --git a/hadoop-tools/hadoop-azure/src/test/resources/wasb.xml b/hadoop-tools/hadoop-azure/src/test/resources/wasb.xml index 5aaca26b8a5..d7cd1a54096 100644 --- a/hadoop-tools/hadoop-azure/src/test/resources/wasb.xml +++ b/hadoop-tools/hadoop-azure/src/test/resources/wasb.xml @@ -161,4 +161,9 @@ true - \ No newline at end of file + + fs.azure.test.namespace.enabled + false + + +