Skip to content

Commit b1d40f6

Browse files
author
bradley childs
committed
Merge pull request #11 from gluster/mkdir_fixes
add mkdir tolerance tests
2 parents aba9deb + 572f6bf commit b1d40f6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/test/java/org/gluster/test/TestGluster.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,33 @@ public static void before() throws Exception{
134134
gfs.initialize(temp.toURI(), conf);
135135
}
136136

137+
138+
139+
@org.junit.Test
140+
public void testTolerantMkdirs() throws Exception{
141+
System.out.println("Testing tollerance of mkdirs(a/b/c/d) then mkdirs(a/b/c)");
142+
Path longPath = new Path("a/b/c/d");
143+
assertFalse(gfs.exists(longPath));
144+
gfs.mkdirs(longPath);
145+
assertTrue(gfs.exists(longPath));
146+
gfs.mkdirs(new Path("a"));
147+
assertTrue(gfs.exists(longPath));
148+
assertTrue(gfs.exists(new Path("a")));
149+
gfs.mkdirs(new Path("a/b"));
150+
assertTrue(gfs.exists(longPath));
151+
assertTrue(gfs.exists(new Path("a/b")));
152+
gfs.mkdirs(new Path("a/b/c"));
153+
assertTrue(gfs.exists(longPath));
154+
assertTrue(gfs.exists(new Path("a/b/c")));
155+
156+
/* delete the directories */
157+
158+
gfs.delete(longPath);
159+
assertFalse(gfs.exists(longPath));
160+
161+
162+
163+
}
137164
@org.junit.Test
138165
public void testTextWriteAndRead() throws Exception{
139166

0 commit comments

Comments
 (0)