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 st...@apache.org on 2017/06/15 13:52:08 UTC

hadoop git commit: HADOOP-14506. Add create() contract test that verifies ancestor dir creation. Contributed by Sean Mackrory.

Repository: hadoop
Updated Branches:
  refs/heads/branch-2 88fa17c23 -> 31446f8e1


HADOOP-14506. Add create() contract test that verifies ancestor dir creation.
Contributed by Sean Mackrory.

(cherry picked from commit d780a67864d2c687d23b69798c19ee865e38cc5a)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/31446f8e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/31446f8e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/31446f8e

Branch: refs/heads/branch-2
Commit: 31446f8e10906a42eddc0306cea564a9d8b12464
Parents: 88fa17c
Author: Steve Loughran <st...@apache.org>
Authored: Thu Jun 15 14:51:50 2017 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Jun 15 14:51:50 2017 +0100

----------------------------------------------------------------------
 .../fs/contract/AbstractContractCreateTest.java   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/31446f8e/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
index 2230fd4..a9ce607 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java
@@ -32,6 +32,7 @@ import java.io.IOException;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.getFileStatusEventually;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.skip;
+import static org.apache.hadoop.fs.contract.ContractTestUtils.touch;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.writeDataset;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.writeTextFile;
 
@@ -272,4 +273,21 @@ public abstract class AbstractContractCreateTest extends
         defaultBlockSize >= minValue);
   }
 
+  @Test
+  public void testCreateMakesParentDirs() throws Throwable {
+    describe("check that after creating a file its parent directories exist");
+    FileSystem fs = getFileSystem();
+    Path grandparent = path("testCreateCreatesAndPopulatesParents");
+    Path parent = new Path(grandparent, "parent");
+    Path child = new Path(parent, "child");
+    touch(fs, child);
+    assertEquals("List status of parent should include the 1 child file",
+        1, fs.listStatus(parent).length);
+    assertTrue("Parent directory does not appear to be a directory",
+        fs.getFileStatus(parent).isDirectory());
+    assertEquals("List status of grandparent should include the 1 parent dir",
+        1, fs.listStatus(grandparent).length);
+    assertTrue("Grandparent directory does not appear to be a directory",
+        fs.getFileStatus(grandparent).isDirectory());
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org