You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/10/07 17:05:28 UTC

[GitHub] [hadoop] xinglin commented on a diff in pull request #4967: HDFS-16791 WIP - client protocol and Filesystem apis implemented and …

xinglin commented on code in PR #4967:
URL: https://github.com/apache/hadoop/pull/4967#discussion_r990318512


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java:
##########
@@ -506,4 +508,29 @@ public void testInternalDirectoryPermissions() throws IOException {
     assertEquals(fs.getFileStatus(subDirOfInternalDir).getPermission(),
         fs.getFileStatus(subDirOfRealDir).getPermission());
   }
+
+  @Test
+  public void testEnclosingRootsBase() throws Exception {
+    final Path zone = new Path("/data/EZ");
+    fsTarget.mkdirs(zone);
+    final Path zone1 = new Path("/data/EZ/zone1");
+    fsTarget.mkdirs(zone1);
+
+    DFSTestUtil.createKey("test_key", cluster, 0, CONF);
+    HdfsAdmin hdfsAdmin = new HdfsAdmin(cluster.getURI(0), CONF);
+    final EnumSet<CreateEncryptionZoneFlag> provisionTrash =
+        EnumSet.of(CreateEncryptionZoneFlag.PROVISION_TRASH);
+    hdfsAdmin.createEncryptionZone(zone1, "test_key", provisionTrash);
+    RemoteIterator<EncryptionZone> zones = hdfsAdmin.listEncryptionZones();
+    assertEquals(fsView.getEnclosingRoot(zone), new Path("/data"));
+    assertEquals(fsView.getEnclosingRoot(zone1), zone1);
+
+    Path nn02Ez = new Path("/mountOnNn2/EZ");
+    fsTarget2.mkdirs(nn02Ez);
+    assertEquals(fsView.getEnclosingRoot((nn02Ez)), new Path("/mountOnNn2"));
+    HdfsAdmin hdfsAdmin2 = new HdfsAdmin(cluster.getURI(1), CONF);
+    DFSTestUtil.createKey("test_key", cluster, 1, CONF);
+    hdfsAdmin2.createEncryptionZone(nn02Ez, "test_key", provisionTrash);
+    assertEquals(fsView.getEnclosingRoot((nn02Ez)), nn02Ez);

Review Comment:
   what I wanted to suggest is to test a file which is stored inside the zone, vs, just test the zone dir itself.
   
   So, instead of 
   
   `assertEquals(fsView.getEnclosingRoot((nn02Ez)), nn02Ez);
   `
   could we do
   
   `assertEquals(fsView.getEnclosingRoot((new Path(nn02Ez, "dir/dir2/file")), nn02Ez);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org