daryn-sharp commented on a change in pull request #2919:
URL: https://github.com/apache/hadoop/pull/2919#discussion_r617648020



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNestedEncryptionZones.java
##########
@@ -210,6 +214,80 @@ public void testNestedEZWithRoot() throws Exception {
         "File not in trash : " + nestedTrashFile, fs.exists(nestedTrashFile));
   }
 
+  @Test(timeout = 60000)
+  public void testRenameBetweenEncryptionZones() throws Exception {
+    String key1 = TOP_EZ_KEY;
+    String key2 = NESTED_EZ_KEY;
+    Path top = new Path("/dir");
+    Path ez1 = new Path(top, "ez1");
+    Path ez2 = new Path(top, "ez2");
+    Path ez3 = new Path(top, "ez3");
+    Path p = new Path(ez1, "file");
+    fs.mkdirs(ez1, FsPermission.getDirDefault());
+    fs.mkdirs(ez2, FsPermission.getDirDefault());
+    fs.mkdirs(ez3, FsPermission.getDirDefault());
+    fs.createEncryptionZone(ez1, key1);
+    fs.createEncryptionZone(ez2, key2);
+    fs.createEncryptionZone(ez3, key1);
+    fs.create(p).close();
+
+    // cannot rename between 2 EZs with different keys.
+    try {
+      fs.rename(p, new Path(ez2, "file"));
+    } catch (RemoteException re) {
+      Assert.assertEquals(
+          p + " can't be moved from encryption zone " + ez1 +
+              " to encryption zone " + ez2 + ".",
+          re.getMessage().split("\n")[0]);
+    }
+    // can rename between 2 EZs with the same key.
+    Assert.assertTrue(fs.rename(p, new Path(ez3, "file")));
+  }
+
+  @Test(timeout = 60000)
+  public void testRemoveEncryptionZoneWithAncestorKey() throws Exception {
+    removeEZDirUnderAncestor(TOP_EZ_KEY);
+  }
+
+  @Test(timeout = 60000)
+  public void testRemoveEncryptionZoneWithNoAncestorKey() throws Exception {
+    removeEZDirUnderAncestor(null);
+  }
+
+  private void removeEZDirUnderAncestor(String parentKey) throws Exception {

Review comment:
       AFAIK, nested EZs have always been supported or at least for a long time 
– otherwise TestNestedEncryptionZones would not already exist, right? :)




-- 
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.

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



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

Reply via email to