Ver código fonte

HDFS-4579. Annotate snapshot tests. Contributed by Arpit Agarwal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1454748 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 12 anos atrás
pai
commit
d32fb8a62b
14 arquivos alterados com 52 adições e 50 exclusões
  1. 2 0
      hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt
  2. 2 2
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImageWithSnapshot.java
  3. 6 6
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java
  4. 11 11
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestDisallowModifyROSnapshot.java
  5. 2 2
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestINodeFileUnderConstructionWithSnapshot.java
  6. 4 4
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java
  7. 3 3
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java
  8. 1 1
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotBlocksMap.java
  9. 9 9
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java
  10. 2 2
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java
  11. 1 1
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotListing.java
  12. 4 4
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotRename.java
  13. 3 3
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotReplication.java
  14. 2 2
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshottableDirListing.java

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-2802.txt

@@ -188,3 +188,5 @@ Branch-2802 Snapshot (Unreleased)
 
   HDFS-4557. Fix FSDirectory#delete when INode#cleanSubtree returns 0.
   (Jing Zhao via szetszwo)
+
+  HDFS-4579. Annotate snapshot tests. (Arpit Agarwal via suresh)

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImageWithSnapshot.java

@@ -168,7 +168,7 @@ public class TestFSImageWithSnapshot {
    * 6. Dump the FSDirectory again and compare the two dumped string.
    * </pre>
    */
-  @Test
+  @Test (timeout=60000)
   public void testSaveLoadImage() throws Exception {
     int s = 0;
     // make changes to the namesystem
@@ -255,7 +255,7 @@ public class TestFSImageWithSnapshot {
   /**
    * Test the fsimage saving/loading while file appending.
    */
-  @Test
+  @Test (timeout=60000)
   public void testSaveLoadImageWithAppending() throws Exception {
     Path sub1 = new Path(dir, "sub1");
     Path sub1file1 = new Path(sub1, "sub1file1");

+ 6 - 6
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java

@@ -80,7 +80,7 @@ public class TestSnapshotPathINodes {
   }
 
   /** Test allow-snapshot operation. */
-  @Test
+  @Test (timeout=15000)
   public void testAllowSnapshot() throws Exception {
     final String path = sub1.toString();
     final INode before = fsdir.getINode(path);
@@ -134,7 +134,7 @@ public class TestSnapshotPathINodes {
    * Test {@link INodeDirectory#getExistingPathINodes(byte[][], int, boolean)} 
    * for normal (non-snapshot) file.
    */
-  @Test
+  @Test (timeout=15000)
   public void testNonSnapshotPathINodes() throws Exception {
     // Get the inodes by resolving the path of a normal file
     String[] names = INode.getPathNames(file1.toString());
@@ -179,7 +179,7 @@ public class TestSnapshotPathINodes {
    * Test {@link INodeDirectory#getExistingPathINodes(byte[][], int, boolean)} 
    * for snapshot file.
    */
-  @Test
+  @Test (timeout=15000)
   public void testSnapshotPathINodes() throws Exception {
     // Create a snapshot for the dir, and check the inodes for the path
     // pointing to a snapshot file
@@ -247,7 +247,7 @@ public class TestSnapshotPathINodes {
    * Test {@link INodeDirectory#getExistingPathINodes(byte[][], int, boolean)} 
    * for snapshot file after deleting the original file.
    */
-  @Test
+  @Test (timeout=15000)
   public void testSnapshotPathINodesAfterDeletion() throws Exception {
     // Create a snapshot for the dir, and check the inodes for the path
     // pointing to a snapshot file
@@ -308,7 +308,7 @@ public class TestSnapshotPathINodes {
    * Test {@link INodeDirectory#getExistingPathINodes(byte[][], int, boolean)} 
    * for snapshot file while adding a new file after snapshot.
    */
-  @Test
+  @Test (timeout=15000)
   public void testSnapshotPathINodesWithAddedFile() throws Exception {
     // Create a snapshot for the dir, and check the inodes for the path
     // pointing to a snapshot file
@@ -367,7 +367,7 @@ public class TestSnapshotPathINodes {
    * Test {@link INodeDirectory#getExistingPathINodes(byte[][], int, boolean)} 
    * for snapshot file while modifying file after snapshot.
    */
-  @Test
+  @Test (timeout=15000)
   public void testSnapshotPathINodesAfterModification() throws Exception {
     //file1 was deleted, create it again.
     DFSTestUtil.createFile(hdfs, file1, 1024, REPLICATION, seed);

+ 11 - 11
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestDisallowModifyROSnapshot.java

@@ -79,22 +79,22 @@ public class TestDisallowModifyROSnapshot {
     }
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testSetReplication() throws Exception {
     fs.setReplication(objInSnapshot, (short) 1);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testSetPermission() throws Exception {
     fs.setPermission(objInSnapshot, new FsPermission("777"));
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testSetOwner() throws Exception {
     fs.setOwner(objInSnapshot, "username", "groupname");
   }
 
-  @Test
+  @Test (timeout=60000)
   public void testRename() throws Exception {
     try {
       fs.rename(objInSnapshot, new Path("/invalid/path"));
@@ -112,39 +112,39 @@ public class TestDisallowModifyROSnapshot {
     } catch (SnapshotAccessControlException e) { /* Ignored */ }
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testDelete() throws Exception {
     fs.delete(objInSnapshot, true);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testQuota() throws Exception {
     fs.setQuota(objInSnapshot, 100, 100);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testSetTime() throws Exception {
     fs.setTimes(objInSnapshot, 100, 100);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testCreate() throws Exception {
     @SuppressWarnings("deprecation")
     DFSClient dfsclient = new DFSClient(conf);
     dfsclient.create(objInSnapshot.toString(), true);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testAppend() throws Exception {
     fs.append(objInSnapshot, 65535, null);
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testMkdir() throws Exception {
     fs.mkdirs(objInSnapshot, new FsPermission("777"));
   }
 
-  @Test(expected = SnapshotAccessControlException.class)
+  @Test(timeout=60000, expected = SnapshotAccessControlException.class)
   public void testCreateSymlink() throws Exception {
     @SuppressWarnings("deprecation")
     DFSClient dfsclient = new DFSClient(conf);

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestINodeFileUnderConstructionWithSnapshot.java

@@ -88,7 +88,7 @@ public class TestINodeFileUnderConstructionWithSnapshot {
   /**
    * Test snapshot after file appending
    */
-  @Test
+  @Test (timeout=60000)
   public void testSnapshotAfterAppending() throws Exception {
     Path file = new Path(dir, "file");
     // 1. create snapshot --> create file --> append
@@ -132,7 +132,7 @@ public class TestINodeFileUnderConstructionWithSnapshot {
    * Test snapshot during file appending, before the corresponding
    * {@link FSDataOutputStream} instance closes.
    */
-  @Test
+  @Test (timeout=60000)
   public void testSnapshotWhileAppending() throws Exception {
     Path file = new Path(dir, "file");
     DFSTestUtil.createFile(hdfs, file, BLOCKSIZE, REPLICATION, seed);

+ 4 - 4
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestNestedSnapshots.java

@@ -81,7 +81,7 @@ public class TestNestedSnapshots {
    * snapshots and the files created after the snapshots should not appear in
    * any of the snapshots.  
    */
-  @Test
+  @Test (timeout=300000)
   public void testNestedSnapshots() throws Exception {
     final Path foo = new Path("/testNestedSnapshots/foo");
     final Path bar = new Path(foo, "bar");
@@ -130,7 +130,7 @@ public class TestNestedSnapshots {
     }
   }
 
-  @Test
+  @Test (timeout=300000)
   public void testSnapshotLimit() throws Exception {
     final int step = 1000;
     final String dirStr = "/testSnapshotLimit/dir";
@@ -168,7 +168,7 @@ public class TestNestedSnapshots {
     }
   }
 
-  @Test
+  @Test (timeout=300000)
   public void testSnapshotWithQuota() throws Exception {
     final String dirStr = "/testSnapshotWithQuota/dir";
     final Path dir = new Path(dirStr);
@@ -230,7 +230,7 @@ public class TestNestedSnapshots {
   /**
    * Test {@link Snapshot#ID_COMPARATOR}.
    */
-  @Test
+  @Test (timeout=300000)
   public void testIdCmp() {
     final PermissionStatus perm = PermissionStatus.createImmutable(
         "user", "group", FsPermission.createImmutable((short)0));

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshot.java

@@ -214,7 +214,7 @@ public class TestSnapshot {
    * -> Check previous snapshots -----------------+
    * </pre>
    */
-  @Test
+  @Test (timeout=300000)
   public void testSnapshot() throws Throwable {
     try {
       runTestSnapshot();
@@ -266,7 +266,7 @@ public class TestSnapshot {
    * A simple test that updates a sub-directory of a snapshottable directory
    * with snapshots
    */
-  @Test
+  @Test (timeout=300000)
   public void testUpdateDirectory() throws Exception {
     Path dir = new Path("/dir");
     Path sub = new Path(dir, "sub");
@@ -292,7 +292,7 @@ public class TestSnapshot {
    * TODO: Listing/Deleting snapshots for a directory that is not snapshottable
    * should also fail.
    */
-  @Test
+  @Test (timeout=300000)
   public void testSnapshottableDirectory() throws Exception {
     Path dir = new Path("/TestSnapshot/sub");
     Path file0 = new Path(dir, "file0");

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotBlocksMap.java

@@ -120,7 +120,7 @@ public class TestSnapshotBlocksMap {
    * Test deleting a file with snapshots. Need to check the blocksMap to make
    * sure the corresponding record is updated correctly.
    */
-  @Test
+  @Test (timeout=60000)
   public void testDeletionWithSnapshots() throws Exception {
     Path file0 = new Path(sub1, "file0");
     Path file1 = new Path(sub1, "file1");

+ 9 - 9
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDeletion.java

@@ -93,7 +93,7 @@ public class TestSnapshotDeletion {
   /**
    * Deleting snapshottable directory with snapshots must fail.
    */
-  @Test
+  @Test (timeout=300000)
   public void testDeleteDirectoryWithSnapshot() throws Exception {
     Path file0 = new Path(sub, "file0");
     Path file1 = new Path(sub, "file1");
@@ -116,7 +116,7 @@ public class TestSnapshotDeletion {
   /**
    * Deleting directory with snapshottable descendant with snapshots must fail.
    */
-  @Test
+  @Test (timeout=300000)
   public void testDeleteDirectoryWithSnapshot2() throws Exception {
     Path file0 = new Path(sub, "file0");
     Path file1 = new Path(sub, "file1");
@@ -153,7 +153,7 @@ public class TestSnapshotDeletion {
    * 4. Delete current INodeDirectoryWithSnapshot.
    * </pre>
    */
-  @Test
+  @Test (timeout=300000)
   public void testDeleteCurrentFileDirectory() throws Exception {
     // create a folder which will be deleted before taking snapshots
     Path deleteDir = new Path(subsub, "deleteDir");
@@ -276,7 +276,7 @@ public class TestSnapshotDeletion {
    * snapshots are taken on the same directory, and we do not need to combine
    * snapshot diffs.
    */
-  @Test
+  @Test (timeout=300000)
   public void testDeleteEarliestSnapshot1() throws Exception {
     // create files under sub
     Path file0 = new Path(sub, "file0");
@@ -343,7 +343,7 @@ public class TestSnapshotDeletion {
    * Also, the recursive cleanTree process should cover both INodeFile and 
    * INodeDirectory.
    */
-  @Test
+  @Test (timeout=300000)
   public void testDeleteEarliestSnapshot2() throws Exception {
     Path noChangeDir = new Path(sub, "noChangeDir");
     Path noChangeFile = new Path(noChangeDir, "noChangeFile");
@@ -421,7 +421,7 @@ public class TestSnapshotDeletion {
    * Test deleting snapshots in a more complicated scenario: need to combine
    * snapshot diffs, but no need to handle diffs distributed in a dir tree
    */
-  @Test
+  @Test (timeout=300000)
   public void testCombineSnapshotDiff1() throws Exception {
     testCombineSnapshotDiffImpl(sub, "");
   }
@@ -430,7 +430,7 @@ public class TestSnapshotDeletion {
    * Test deleting snapshots in more complicated scenarios (snapshot diffs are
    * distributed in the directory sub-tree)
    */
-  @Test
+  @Test (timeout=300000)
   public void testCombineSnapshotDiff2() throws Exception {
     testCombineSnapshotDiffImpl(sub, "subsub1/subsubsub1/");
   }
@@ -536,7 +536,7 @@ public class TestSnapshotDeletion {
   }
   
   /** Test deleting snapshots with modification on the metadata of directory */ 
-  @Test
+  @Test (timeout=300000)
   public void testDeleteSnapshotWithDirModification() throws Exception {
     Path file = new Path(sub, "file");
     DFSTestUtil.createFile(hdfs, file, BLOCKSIZE, REPLICATION, seed);
@@ -574,7 +574,7 @@ public class TestSnapshotDeletion {
    * A test covering the case where the snapshot diff to be deleted is renamed 
    * to its previous snapshot. 
    */
-  @Test
+  @Test (timeout=300000)
   public void testRenameSnapshotDiff() throws Exception {
     final Path subFile0 = new Path(sub, "file0");
     final Path subsubFile0 = new Path(subsub, "file0");

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java

@@ -169,7 +169,7 @@ public class TestSnapshotDiffReport {
   }
   
   /** Test the computation and representation of diff between snapshots */
-  @Test
+  @Test (timeout=60000)
   public void testDiffReport() throws Exception {
     Path subsub1 = new Path(sub1, "subsub1");
     Path subsubsub1 = new Path(subsub1, "subsubsub1");
@@ -261,7 +261,7 @@ public class TestSnapshotDiffReport {
    * sure the diff report computation correctly retrieve the diff from the
    * deleted sub-directory.
    */
-  @Test
+  @Test (timeout=60000)
   public void testDiffReport2() throws Exception {
     Path subsub1 = new Path(sub1, "subsub1");
     Path subsubsub1 = new Path(subsub1, "subsubsub1");

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotListing.java

@@ -67,7 +67,7 @@ public class TestSnapshotListing {
   /**
    * Test listing snapshots under a snapshottable directory
    */
-  @Test
+  @Test (timeout=15000)
   public void testListSnapshots() throws Exception {
     final Path snapshotsPath = new Path(dir, ".snapshot");
     FileStatus[] stats = null;

+ 4 - 4
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotRename.java

@@ -102,7 +102,7 @@ public class TestSnapshotRename {
    * Rename snapshot(s), and check the correctness of the snapshot list within
    * {@link INodeDirectorySnapshottable}
    */
-  @Test
+  @Test (timeout=60000)
   public void testSnapshotList() throws Exception {
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
     // Create three snapshots for sub1
@@ -132,7 +132,7 @@ public class TestSnapshotRename {
   /**
    * Test FileStatus of snapshot file before/after rename
    */
-  @Test
+  @Test (timeout=60000)
   public void testSnapshotRename() throws Exception {
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
     // Create snapshot for sub1
@@ -161,7 +161,7 @@ public class TestSnapshotRename {
   /**
    * Test rename a non-existing snapshot
    */
-  @Test
+  @Test (timeout=60000)
   public void testRenameNonExistingSnapshot() throws Exception {
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
     // Create snapshot for sub1
@@ -177,7 +177,7 @@ public class TestSnapshotRename {
   /**
    * Test rename a snapshot to another existing snapshot 
    */
-  @Test
+  @Test (timeout=60000)
   public void testRenameToExistingSnapshot() throws Exception {
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
     // Create snapshots for sub1

+ 3 - 3
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotReplication.java

@@ -104,7 +104,7 @@ public class TestSnapshotReplication {
   /**
    * Test replication number calculation for a normal file without snapshots.
    */
-  @Test
+  @Test (timeout=60000)
   public void testReplicationWithoutSnapshot() throws Exception {
     // Create file1, set its replication to REPLICATION
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);
@@ -157,7 +157,7 @@ public class TestSnapshotReplication {
   /**
    * Test replication number calculation for a file with snapshots.
    */
-  @Test
+  @Test (timeout=60000)
   public void testReplicationWithSnapshot() throws Exception {
     short fileRep = 1;
     // Create file1, set its replication to 1
@@ -198,7 +198,7 @@ public class TestSnapshotReplication {
    * Test replication for a file with snapshots, also including the scenario
    * where the original file is deleted
    */
-  @Test
+  @Test (timeout=60000)
   public void testReplicationAfterDeletion() throws Exception {
     // Create file1, set its replication to 3
     DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, seed);

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshottableDirListing.java

@@ -73,7 +73,7 @@ public class TestSnapshottableDirListing {
   /**
    * Test listing all the snapshottable directories
    */
-  @Test
+  @Test (timeout=60000)
   public void testListSnapshottableDir() throws Exception {
     // Initially there is no snapshottable directories in the system
     SnapshottableDirectoryStatus[] dirs = hdfs.getSnapshottableDirListing();
@@ -156,7 +156,7 @@ public class TestSnapshottableDirListing {
    * Test the listing with different user names to make sure only directories
    * that are owned by the user are listed.
    */
-  @Test
+  @Test (timeout=60000)
   public void testListWithDifferentUser() throws Exception {
     // first make dir1 and dir2 snapshottable
     hdfs.allowSnapshot(dir1.toString());