[GitHub] flink pull request #4311: [FLINK-7162] [test] Tests should not write outside...

2017-07-18 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/flink/pull/4311


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4311: [FLINK-7162] [test] Tests should not write outside...

2017-07-17 Thread StephanEwen
Github user StephanEwen commented on a diff in the pull request:

https://github.com/apache/flink/pull/4311#discussion_r127793662
  
--- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
 ---
@@ -51,11 +54,14 @@
 
private File blobStorageDirectory;
 
+   @Rule
+   public TemporaryFolder temporaryFolder = new TemporaryFolder();
--- End diff --

Same here...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4311: [FLINK-7162] [test] Tests should not write outside...

2017-07-17 Thread StephanEwen
Github user StephanEwen commented on a diff in the pull request:

https://github.com/apache/flink/pull/4311#discussion_r127793602
  
--- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobUtilsTest.java ---
@@ -22,26 +22,29 @@
 import static org.junit.Assume.assumeTrue;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.io.Files;
-
 import org.apache.flink.util.OperatingSystem;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Rule;
 
 import java.io.File;
 import java.io.IOException;
+import org.junit.rules.TemporaryFolder;
 
 public class BlobUtilsTest {
 
private final static String CANNOT_CREATE_THIS = "cannot-create-this";
 
private File blobUtilsTestDirectory;
 
+   @Rule
+   public TemporaryFolder temporaryFolder = new TemporaryFolder();
--- End diff --

I think it is good practice to make such variables `final`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4311: [FLINK-7162] [test] Tests should not write outside...

2017-07-17 Thread StephanEwen
Github user StephanEwen commented on a diff in the pull request:

https://github.com/apache/flink/pull/4311#discussion_r127793846
  
--- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobUtilsTest.java ---
@@ -22,26 +22,29 @@
 import static org.junit.Assume.assumeTrue;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.io.Files;
-
 import org.apache.flink.util.OperatingSystem;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Rule;
 
 import java.io.File;
 import java.io.IOException;
+import org.junit.rules.TemporaryFolder;
 
 public class BlobUtilsTest {
 
private final static String CANNOT_CREATE_THIS = "cannot-create-this";
 
private File blobUtilsTestDirectory;
 
+   @Rule
+   public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
@Before
-   public void before() {
+   public void before() throws IOException {
// Prepare test directory
-   blobUtilsTestDirectory = Files.createTempDir();
+   blobUtilsTestDirectory = temporaryFolder.newFolder();
--- End diff --

Minor issue: Would be nice to move this after the OS check, keep the 
directory operations logically together.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] flink pull request #4311: [FLINK-7162] [test] Tests should not write outside...

2017-07-12 Thread zhangminglei
GitHub user zhangminglei opened a pull request:

https://github.com/apache/flink/pull/4311

[FLINK-7162] [test] Tests should not write outside 'target' directory

A few tests use ```Files.createTempDir()``` from Guava package, but do not 
set java.io.tmpdir system property. Thus the temp directory is created in 
unpredictable places and is not being cleaned up by ```mvn clean```.
This was probably introduced in ```JobManagerStartupTest``` and then 
replicated in ```BlobUtilsTest```.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/zhangminglei/flink flink-7162

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/flink/pull/4311.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #4311


commit 159af161e6b3f5957731bc0ffb13e52afd1ef726
Author: zhangminglei 
Date:   2017-07-12T12:46:21Z

[FLINK-7162] [test] Tests should not write outside 'target' directory




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---