HDFS-7139. Unit test for creating encryption zone on root path. (Zhe Zhang via 
wang)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/63198bfb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/63198bfb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/63198bfb

Branch: refs/heads/HDFS-6581
Commit: 63198bfba7b899b33f26c079bc8241dad1bdbc57
Parents: 3cde37c
Author: Andrew Wang <w...@apache.org>
Authored: Wed Sep 24 16:40:20 2014 -0700
Committer: Andrew Wang <w...@apache.org>
Committed: Wed Sep 24 16:40:20 2014 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  2 ++
 .../apache/hadoop/hdfs/TestEncryptionZones.java | 21 ++++++++++++++++++++
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/63198bfb/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index d97203f..25f4ddc 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -575,6 +575,8 @@ Release 2.6.0 - UNRELEASED
     HDFS-6987. Move CipherSuite xattr information up to the encryption zone
     root. (Zhe Zhang via wang)
 
+    HDFS-7139. Unit test for creating encryption zone on root path. (Zhe Zhang 
via wang)
+
   OPTIMIZATIONS
 
     HDFS-6690. Deduplicate xattr names in memory. (wang)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/63198bfb/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
index b80fd45..05b39c3 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
@@ -1177,4 +1177,25 @@ public class TestEncryptionZones {
     parser.parse(new InputSource(new StringReader(xml)), new DefaultHandler());
   }
 
+  /**
+   * Test creating encryption zone on the root path
+   */
+  @Test(timeout = 60000)
+  public void testEncryptionZonesOnRootPath() throws Exception {
+    final int len = 8196;
+    final Path rootDir = new Path("/");
+    final Path zoneFile = new Path(rootDir, "file");
+    final Path rawFile = new Path("/.reserved/raw/file");
+    dfsAdmin.createEncryptionZone(rootDir, TEST_KEY);
+    DFSTestUtil.createFile(fs, zoneFile, len, (short) 1, 0xFEED);
+
+    assertEquals("File can be created on the root encryption zone " +
+            "with correct length",
+        len, fs.getFileStatus(zoneFile).getLen());
+    assertEquals("Root dir is encrypted",
+        true, fs.getFileStatus(rootDir).isEncrypted());
+    assertEquals("File is encrypted",
+        true, fs.getFileStatus(zoneFile).isEncrypted());
+    DFSTestUtil.verifyFilesNotEqual(fs, zoneFile, rawFile, len);
+  }
 }

Reply via email to