Repository: beam
Updated Branches:
  refs/heads/master d8d3f3093 -> 62294e64c


Fix leaking directories/files on ApexYarnLauncherTest


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/10a49a5a
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/10a49a5a
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/10a49a5a

Branch: refs/heads/master
Commit: 10a49a5a9401c5b7ddf57fd6463b6888e5ecbaf0
Parents: c58c42c
Author: Ismaël Mejía <[email protected]>
Authored: Mon Aug 21 18:07:07 2017 +0200
Committer: Ismaël Mejía <[email protected]>
Committed: Tue Aug 22 09:52:45 2017 +0200

----------------------------------------------------------------------
 .../org/apache/beam/runners/apex/ApexYarnLauncherTest.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/10a49a5a/runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java
----------------------------------------------------------------------
diff --git 
a/runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java
 
b/runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java
index 68ec2ea..adaf67b 100644
--- 
a/runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java
+++ 
b/runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java
@@ -43,12 +43,15 @@ import org.apache.apex.api.Launcher.LaunchMode;
 import org.apache.commons.io.FileUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 /**
  * Test for dependency resolution for pipeline execution on YARN.
  */
 public class ApexYarnLauncherTest {
+  @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
 
   @Test
   public void testGetYarnDeployDependencies() throws Exception {
@@ -119,10 +122,9 @@ public class ApexYarnLauncherTest {
 
   @Test
   public void testCreateJar() throws Exception {
-    File baseDir = new File("./target/testCreateJar");
-    File srcDir = new File(baseDir, "src");
+    File baseDir = tmpFolder.newFolder("target", "testCreateJar");
+    File srcDir = tmpFolder.newFolder("target", "testCreateJar", "src");
     String file1 = "file1";
-    FileUtils.forceMkdir(srcDir);
     FileUtils.write(new File(srcDir, file1), "file1");
 
     File jarFile = new File(baseDir, "test.jar");
@@ -134,6 +136,5 @@ public class ApexYarnLauncherTest {
       Assert.assertTrue("manifest", 
Files.isRegularFile(zipfs.getPath(JarFile.MANIFEST_NAME)));
       Assert.assertTrue("file1", Files.isRegularFile(zipfs.getPath(file1)));
     }
-
   }
 }

Reply via email to