From 8e291e1015c4694f7b11cd97a6308d0d92a884cb Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Tue, 14 Feb 2017 08:59:12 -0800 Subject: [PATCH] HDFS-11084. Add a regression test for sticky bit support of OIV ReverseXML processor. Contributed by Wei-Chiu Chuang. (cherry picked from commit 89cadb42111e4ffbd3f4bde8250013bba23eb51e) --- .../offlineImageViewer/TestOfflineImageViewer.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java index 740a8ab2743..dacbb859b38 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java @@ -69,6 +69,8 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystemTestHelper; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsAction; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.DistributedFileSystem; @@ -158,6 +160,15 @@ public class TestOfflineImageViewer { hdfs.mkdirs(invalidXMLDir); dirCount++; + //Create a directory with sticky bits + Path stickyBitDir = new Path("/stickyBit"); + hdfs.mkdirs(stickyBitDir); + hdfs.setPermission(stickyBitDir, new FsPermission(FsAction.ALL, + FsAction.ALL, FsAction.ALL, true)); + dirCount++; + writtenFiles.put(stickyBitDir.toString(), + hdfs.getFileStatus(stickyBitDir)); + // Get delegation tokens so we log the delegation token op Token[] delegationTokens = hdfs .addDelegationTokens(TEST_RENEWER, null);