Jelajahi Sumber

HADOOP-16687. ABFS: Fix testcase added for HADOOP-16138 for namespace enabled account. (#1701)

Sneha Vijayarajan 5 tahun lalu
induk
melakukan
de38045021

+ 7 - 9
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCLI.java

@@ -22,8 +22,8 @@ import java.util.UUID;
 
 import org.junit.Test;
 
-import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FsShell;
 
 import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION;
 import static org.apache.hadoop.fs.azurebfs.constants.FileSystemUriSchemes.ABFS_SCHEME;
@@ -36,8 +36,6 @@ public class ITestAzureBlobFileSystemCLI extends AbstractAbfsIntegrationTest {
 
   public  ITestAzureBlobFileSystemCLI() throws Exception {
     super();
-    final AbfsConfiguration conf = getConfiguration();
-    conf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, false);
   }
 
   /**
@@ -51,14 +49,14 @@ public class ITestAzureBlobFileSystemCLI extends AbstractAbfsIntegrationTest {
   @Test
   public void testMkdirRootNonExistentContainer() throws Exception {
     final Configuration rawConf = getRawConfiguration();
-    FsShell fsShell = new FsShell(rawConf);
-    final String account =
-        rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null);
-
+    final String account = rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null);
+    rawConf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION,
+        false);
     String nonExistentContainer = "nonexistent-" + UUID.randomUUID();
+    FsShell fsShell = new FsShell(rawConf);
 
-    int result = fsShell.run(new String[] { "-mkdir",
-        ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/" });
+    int result = fsShell.run(new String[] {"-mkdir",
+        ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/"});
 
     assertEquals(1, result);
   }