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


##########
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:
   I don't think an encryption zone can span multiple mount points



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to