Author: szetszwo
Date: Wed Jan 21 13:35:25 2009
New Revision: 736419

URL: http://svn.apache.org/viewvc?rev=736419&view=rev
Log:
HADOOP-5050. TestDFSShell.testFilePermissions should not assume umask setting.  
(Jakob Homan via szetszwo)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestDFSShell.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=736419&r1=736418&r2=736419&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Jan 21 13:35:25 2009
@@ -58,6 +58,9 @@
     HADOOP-5072. Fix failure in TestCodec because testSequenceFileGzipCodec 
     won't pass without native gzip codec. (Zheng Shao via dhruba)
 
+    HADOOP-5050. TestDFSShell.testFilePermissions should not assume umask
+    setting.  (Jakob Homan via szetszwo)
+
 Release 0.20.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestDFSShell.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestDFSShell.java?rev=736419&r1=736418&r2=736419&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestDFSShell.java 
(original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestDFSShell.java Wed Jan 
21 13:35:25 2009
@@ -34,6 +34,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSInputChecker;
 import org.apache.hadoop.fs.FileSystem;
@@ -54,6 +56,8 @@
  * This class tests commands from DFSShell.
  */
 public class TestDFSShell extends TestCase {
+  private static final Log LOG = LogFactory.getLog(TestDFSShell.class);
+  
   static final String TEST_ROOT_DIR =
     new Path(System.getProperty("test.build.data","/tmp"))
     .toString().replace(' ', '+');
@@ -777,9 +781,11 @@
      // test sticky bit on directories
      Path dir2 = new Path(dir, "stickybit" );
      fs.mkdirs(dir2 );
+     LOG.info("Testing sticky bit on: " + dir2);
+     LOG.info("Sticky bit directory initial mode: " + 
+                   fs.getFileStatus(dir2).getPermission());
      
-     assertEquals("rwxr-xr-x", fs.getFileStatus(dir2).getPermission()
-         .toString());
+     confirmPermissionChange("u=rwx,g=rx,o=rx", "rwxr-xr-x", fs, shell, dir2);
      
      confirmPermissionChange("+t", "rwxr-xr-t", fs, shell, dir2);
 
@@ -792,9 +798,10 @@
      confirmPermissionChange("1666", "rw-rw-rwT", fs, shell, dir2);
 
      confirmPermissionChange("777", "rwxrwxrwt", fs, shell, dir2);
-
-     fs.delete(dir, true);
+     
      fs.delete(dir2, true);
+     fs.delete(dir, true);
+     
     } finally {
       try {
         fs.close();
@@ -807,9 +814,13 @@
   // is the one you were expecting
   private void confirmPermissionChange(String toApply, String expected,
       FileSystem fs, FsShell shell, Path dir2) throws IOException {
+    LOG.info("Confirming permission change of " + toApply + " to " + expected);
     runCmd(shell, "-chmod", toApply, dir2.toString());
-    
-    assertEquals(expected, fs.getFileStatus(dir2).getPermission().toString());
+
+    String result = fs.getFileStatus(dir2).getPermission().toString();
+
+    LOG.info("Permission change result: " + result);
+    assertEquals(expected, result);
   }
    
   private void confirmOwner(String owner, String group, 


Reply via email to