Skip to content

Commit 88c2276

Browse files
committed
delete tmp file on exit, and in cleanup
1 parent e7fd55d commit 88c2276

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/java/org/gluster/test/TestGlusterFuseInputStream.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import org.apache.hadoop.fs.glusterfs.GlusterFUSEInputStream;
88
import org.apache.hadoop.fs.glusterfs.GlusterFUSEOutputStream;
9+
import org.junit.After;
910
import org.junit.Before;
1011
import org.junit.Test;
1112

@@ -16,11 +17,16 @@ public class TestGlusterFuseInputStream{
1617
public void create() throws Exception{
1718
//setup: no need for gluster specific path, since its just reading from local path
1819
infile=File.createTempFile("TestGlusterFuseInputStream"+System.currentTimeMillis(),"txt").getAbsolutePath();
19-
final GlusterFUSEOutputStream stream = new GlusterFUSEOutputStream(infile,true);
20+
new File(infile).deleteOnExit();
21+
final GlusterFUSEOutputStream stream = new GlusterFUSEOutputStream(infile,true);
2022
stream.write("hello there, certainly, there is some data in this stream".getBytes());
2123
stream.close();
2224
}
2325

26+
@After
27+
public void cleanUp() throws Exception{
28+
new File(infile).delete();
29+
}
2430
@Test
2531
public void testDoubleClose() throws Exception{
2632
//test

0 commit comments

Comments
 (0)