hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1476585 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java
Date Sat, 27 Apr 2013 14:16:32 GMT
Author: suresh
Date: Sat Apr 27 14:16:32 2013
New Revision: 1476585

URL: http://svn.apache.org/r1476585
Log:
HDFS-4741. TestStorageRestore#testStorageRestoreFailure fails on Windows. Contributed by Arpit
Agarwal.

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1476585&r1=1476584&r2=1476585&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Sat Apr 27 14:16:32 2013
@@ -311,6 +311,9 @@ Trunk (Unreleased)
     HDFS-4584. Skip TestNNWithQJM.testNewNamenodeTakesOverWriter() on Windows.
     (Arpit Agarwal via szetszwo)
 
+    HDFS-4741. TestStorageRestore#testStorageRestoreFailure fails on Windows.
+    (Arpit Agarwal via suresh)
+
   BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
 
     HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java?rev=1476585&r1=1476584&r2=1476585&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java
Sat Apr 27 14:16:32 2013
@@ -47,6 +47,7 @@ import org.apache.hadoop.hdfs.HdfsConfig
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
 import org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream;
+import org.apache.hadoop.util.Shell;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -362,7 +363,7 @@ public class TestStorageRestore {
       }
     }
   }
-  
+
   /**
    * 1. create DFS cluster with 3 storage directories
    *    - 2 EDITS_IMAGE(name1, name2), 1 EDITS(name3)
@@ -379,8 +380,16 @@ public class TestStorageRestore {
    */
   @Test
   public void testStorageRestoreFailure() throws Exception {
-
     SecondaryNameNode secondary = null;
+
+    // On windows, revoking write+execute permission on name2 does not
+    // prevent us from creating files in name2\current. Hence we revoke
+    // permissions on name2\current for the test.
+    String nameDir2 = Shell.WINDOWS ?
+        (new File(path2, "current").getAbsolutePath()) : path2.toString();
+    String nameDir3 = Shell.WINDOWS ?
+        (new File(path3, "current").getAbsolutePath()) : path3.toString();
+
     try {
       cluster = new MiniDFSCluster.Builder(config).numDataNodes(0)
           .manageNameDfsDirs(false).build();
@@ -394,8 +403,8 @@ public class TestStorageRestore {
       assertTrue(fs.mkdirs(path));
 
       // invalidate storage by removing rwx permission from name2 and name3
-      FileUtil.chmod(path2.toString(), "000");
-      FileUtil.chmod(path3.toString(), "000");
+      assertTrue(FileUtil.chmod(nameDir2, "000") == 0);
+      assertTrue(FileUtil.chmod(nameDir3, "000") == 0);
       secondary.doCheckpoint(); // should remove name2 and name3
 
       printStorages(cluster.getNameNode().getFSImage());
@@ -409,18 +418,18 @@ public class TestStorageRestore {
       assert (cluster.getNameNode().getFSImage().getStorage()
           .getNumStorageDirs() == 1);
 
-      FileUtil.chmod(path2.toString(), "755");
-      FileUtil.chmod(path3.toString(), "755");
+      assertTrue(FileUtil.chmod(nameDir2, "755") == 0);
+      assertTrue(FileUtil.chmod(nameDir3, "755") == 0);
       secondary.doCheckpoint(); // should restore name 2 and 3
       assert (cluster.getNameNode().getFSImage().getStorage()
           .getNumStorageDirs() == 3);
 
     } finally {
       if (path2.exists()) {
-        FileUtil.chmod(path2.toString(), "755");
+        FileUtil.chmod(nameDir2, "755");
       }
       if (path3.exists()) {
-        FileUtil.chmod(path3.toString(), "755");
+        FileUtil.chmod(nameDir3, "755");
       }
       if (cluster != null) {
         cluster.shutdown();



Mime
View raw message