You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2018/06/08 00:02:18 UTC
[04/14] hadoop git commit: HDFS-13659. Add more test coverage for
contentSummary for snapshottable path. Contributed by Wei-Chiu Chuang.
HDFS-13659. Add more test coverage for contentSummary for snapshottable path. Contributed by Wei-Chiu Chuang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e39b113d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e39b113d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e39b113d
Branch: refs/heads/HADOOP-15461
Commit: e39b113db0f2e4bcf93f873801be770e472601da
Parents: f494f0b
Author: Wei-Chiu Chuang <we...@apache.org>
Authored: Thu Jun 7 08:30:06 2018 -0700
Committer: Wei-Chiu Chuang <we...@apache.org>
Committed: Thu Jun 7 08:30:06 2018 -0700
----------------------------------------------------------------------
.../TestGetContentSummaryWithSnapshot.java | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e39b113d/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestGetContentSummaryWithSnapshot.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestGetContentSummaryWithSnapshot.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestGetContentSummaryWithSnapshot.java
index dc6f584..1c16818 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestGetContentSummaryWithSnapshot.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestGetContentSummaryWithSnapshot.java
@@ -81,6 +81,9 @@ public class TestGetContentSummaryWithSnapshot {
* 3. create a 10 byte file /foo/bar/baz
* Make sure for "/foo/bar" and "/foo/.snapshot/s1/bar" have correct results:
* the 1 byte file is not included in snapshot s1.
+ * 4. create another snapshot, append to the file /foo/bar/baz,
+ * and make sure file count, directory count and file length is good.
+ * 5. delete the file, ensure contentSummary output too.
*/
@Test
public void testGetContentSummary() throws IOException {
@@ -118,6 +121,29 @@ public class TestGetContentSummaryWithSnapshot {
Assert.assertEquals(0, summary.getFileCount());
Assert.assertEquals(0, summary.getLength());
+ // create a new snapshot s2 and update the file
+ dfs.createSnapshot(foo, "s2");
+ DFSTestUtil.appendFile(dfs, baz, 10);
+ summary = cluster.getNameNodeRpc().getContentSummary(
+ bar.toString());
+ Assert.assertEquals(1, summary.getDirectoryCount());
+ Assert.assertEquals(1, summary.getFileCount());
+ Assert.assertEquals(20, summary.getLength());
+
+ final Path fooS2 = SnapshotTestHelper.getSnapshotRoot(foo, "s2");
+ summary = cluster.getNameNodeRpc().getContentSummary(fooS2.toString());
+ Assert.assertEquals(2, summary.getDirectoryCount());
+ Assert.assertEquals(1, summary.getFileCount());
+ Assert.assertEquals(10, summary.getLength());
+
+ cluster.getNameNodeRpc().delete(baz.toString(), false);
+
+ summary = cluster.getNameNodeRpc().getContentSummary(
+ foo.toString());
+ Assert.assertEquals(0, summary.getSnapshotDirectoryCount());
+ Assert.assertEquals(1, summary.getSnapshotFileCount());
+ Assert.assertEquals(20, summary.getSnapshotLength());
+
final Path bazS1 = SnapshotTestHelper.getSnapshotPath(foo, "s1", "bar/baz");
try {
cluster.getNameNodeRpc().getContentSummary(bazS1.toString());
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org