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
This commit is contained in:
parent
82230367ba
commit
d32fb8a62b
@ -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)
|
||||
|
@ -168,7 +168,7 @@ private void loadFSImageFromTempFile(File imageFile) throws IOException {
|
||||
* 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 @@ void checkImage(int s) throws IOException {
|
||||
/**
|
||||
* 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");
|
||||
|
@ -80,7 +80,7 @@ static public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/** 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 @@ static void assertINodeFile(INode inode, Path path) {
|
||||
* 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 void testNonSnapshotPathINodes() throws Exception {
|
||||
* 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 void testSnapshotPathINodes() throws Exception {
|
||||
* 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 void testSnapshotPathINodesAfterDeletion() throws Exception {
|
||||
* 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 void testSnapshotPathINodesWithAddedFile() throws Exception {
|
||||
* 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);
|
||||
|
@ -79,22 +79,22 @@ public static void tearDown() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@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 void testRename() throws Exception {
|
||||
} 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);
|
||||
|
@ -88,7 +88,7 @@ public void tearDown() throws Exception {
|
||||
/**
|
||||
* 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 @@ private HdfsDataOutputStream appendFileWithoutClosing(Path file, int length)
|
||||
* 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);
|
||||
|
@ -81,7 +81,7 @@ public static void tearDown() throws Exception {
|
||||
* 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 @@ private static void assertFile(Path s1, Path s2, Path file,
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test (timeout=300000)
|
||||
public void testSnapshotLimit() throws Exception {
|
||||
final int step = 1000;
|
||||
final String dirStr = "/testSnapshotLimit/dir";
|
||||
@ -168,7 +168,7 @@ public void testSnapshotLimit() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@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 void testSnapshotWithQuota() throws Exception {
|
||||
/**
|
||||
* Test {@link Snapshot#ID_COMPARATOR}.
|
||||
*/
|
||||
@Test
|
||||
@Test (timeout=300000)
|
||||
public void testIdCmp() {
|
||||
final PermissionStatus perm = PermissionStatus.createImmutable(
|
||||
"user", "group", FsPermission.createImmutable((short)0));
|
||||
|
@ -214,7 +214,7 @@ private void checkFSImage() throws Exception {
|
||||
* -> Check previous snapshots -----------------+
|
||||
* </pre>
|
||||
*/
|
||||
@Test
|
||||
@Test (timeout=300000)
|
||||
public void testSnapshot() throws Throwable {
|
||||
try {
|
||||
runTestSnapshot();
|
||||
@ -266,7 +266,7 @@ private void runTestSnapshot() throws Exception {
|
||||
* 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 void testUpdateDirectory() throws Exception {
|
||||
* 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");
|
||||
|
@ -120,7 +120,7 @@ void assertBlockCollection(final INodeFile file, final BlockInfo b) {
|
||||
* 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");
|
||||
|
@ -93,7 +93,7 @@ public void tearDown() throws Exception {
|
||||
/**
|
||||
* 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 void testDeleteDirectoryWithSnapshot() throws Exception {
|
||||
/**
|
||||
* 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 void testDeleteDirectoryWithSnapshot2() throws Exception {
|
||||
* 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 void testDeleteCurrentFileDirectory() throws Exception {
|
||||
* 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 void testDeleteEarliestSnapshot1() throws Exception {
|
||||
* 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 void testDeleteEarliestSnapshot2() throws Exception {
|
||||
* 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 void testCombineSnapshotDiff1() throws Exception {
|
||||
* 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 @@ private void testCombineSnapshotDiffImpl(Path snapshotRoot, String modDirStr)
|
||||
}
|
||||
|
||||
/** 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 void testDeleteSnapshotWithDirModification() throws Exception {
|
||||
* 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");
|
||||
|
@ -169,7 +169,7 @@ private void verifyDiffReport(Path dir, String from, String to,
|
||||
}
|
||||
|
||||
/** 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 void testDiffReport() throws Exception {
|
||||
* 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");
|
||||
|
@ -67,7 +67,7 @@ public void tearDown() throws Exception {
|
||||
/**
|
||||
* 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;
|
||||
|
@ -102,7 +102,7 @@ private void checkSnapshotList(INodeDirectorySnapshottable srcRoot,
|
||||
* 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 void testSnapshotList() throws Exception {
|
||||
/**
|
||||
* 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 void testSnapshotRename() throws Exception {
|
||||
/**
|
||||
* 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 void testRenameNonExistingSnapshot() throws Exception {
|
||||
/**
|
||||
* 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
|
||||
|
@ -104,7 +104,7 @@ private void checkFileReplication(Path file, short replication,
|
||||
/**
|
||||
* 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 @@ private void checkSnapshotFileReplication(Path currentFile,
|
||||
/**
|
||||
* 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 void testReplicationWithSnapshot() throws Exception {
|
||||
* 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);
|
||||
|
@ -73,7 +73,7 @@ public void tearDown() throws Exception {
|
||||
/**
|
||||
* 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 void testListSnapshottableDir() throws Exception {
|
||||
* 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());
|
||||
|
Loading…
Reference in New Issue
Block a user