You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/10/21 21:21:20 UTC

[GitHub] [incubator-gobblin] aplex commented on a change in pull request #3131: GOBBLIN-1292: Undo hardcoded tmp directory locations for unit tests

aplex commented on a change in pull request #3131:
URL: https://github.com/apache/incubator-gobblin/pull/3131#discussion_r509700611



##########
File path: gobblin-cluster/src/test/java/org/apache/gobblin/cluster/FsJobConfigurationManagerTest.java
##########
@@ -91,6 +91,10 @@ public void setUp() throws IOException {
       return null;
     }).when(this.eventBus).post(Mockito.anyObject());
 
+    File tmpDir = Files.createTempDir();
+    tmpDir.deleteOnExit();
+    this.jobConfDir = tmpDir.getAbsolutePath() + "/" + this.getClass().getSimpleName() + "/jobCatalog";

Review comment:
       Is it important to have a class name in this path? AFAIK, createTempDir will return a unique path on each call. (same in other test classes below)

##########
File path: gobblin-cluster/src/test/java/org/apache/gobblin/cluster/suite/IntegrationJobCancelSuite.java
##########
@@ -17,14 +17,22 @@
 
 package org.apache.gobblin.cluster.suite;
 
+import java.io.File;
+
 import org.junit.Assert;
 
+import com.google.common.io.Files;
 import com.typesafe.config.Config;
 
 
 public class IntegrationJobCancelSuite extends IntegrationBasicSuite {
   public static final String JOB_ID = "job_HelloWorldTestJob_1234";
-  public static final String TASK_STATE_FILE = "/tmp/IntegrationJobCancelSuite/taskState/_RUNNING";
+  public static final String TASK_STATE_FILE;
+  static {
+    File tmpDir = Files.createTempDir();

Review comment:
       Does this need to happen in static block? Can it happen for the instance of a class? Accessing file system from static block looks strange to me. Also TASK_STATE_FILE seems to be like a constant, but it changes on every application run.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org