flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hsapu...@apache.org
Subject flink git commit: [FLINK-1651] Fix test case at JobManagerStartupTest to avoid hang on certain users
Date Mon, 09 Mar 2015 16:21:13 GMT
Repository: flink
Updated Branches:
  refs/heads/master 5242e9668 -> f5824499e


[FLINK-1651] Fix test case at JobManagerStartupTest to avoid hang on certain users

JobManagerStartupTest should not assume user could not create /does-not-exist-no-sir dir.

Sometimes, user that run tests could have write access to root directory so creating /does-not-exist-no-sir
is possible,
hence no exception thrown.

Need to construct a Flink test directory under directory specified under "java.io.tmpdir"
and change the permission
to not allow create new directory.

Author: Henry Saputra <henry.saputra@gmail.com>

Closes #460 from hsaputra/FLINK-1651_fix_jobmanager_fail_test and squashes the following commits:

5d46716 [Henry Saputra] [FLINK-1651] Fix test case at JobManagerStartupTest should not assume
user could not create /does-not-exist-no-sir dir.


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

Branch: refs/heads/master
Commit: f5824499e0dd6c518fe54ee37361f794a71d2b2f
Parents: 5242e96
Author: Henry Saputra <henry.saputra@gmail.com>
Authored: Mon Mar 9 09:21:04 2015 -0700
Committer: Henry Saputra <henry.saputra@gmail.com>
Committed: Mon Mar 9 09:21:04 2015 -0700

----------------------------------------------------------------------
 .../jobmanager/JobManagerStartupTest.java       | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/f5824499/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
index 63c8d14..4884b19 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerStartupTest.java
@@ -20,12 +20,18 @@ package org.apache.flink.runtime.jobmanager;
 
 import static org.junit.Assert.*;
 
+import java.io.File;
 import java.net.InetAddress;
 import java.net.ServerSocket;
 
+import com.google.common.io.Files;
+
 import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.runtime.net.NetUtils;
+
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -34,6 +40,26 @@ import org.junit.Test;
  */
 public class JobManagerStartupTest {
 
+	private final static String DOES_NOT_EXISTS_NO_SIR = "does-not-exist-no-sir";
+
+	private File blobStorageDirectory;
+
+	@Before
+	public void before() {
+		// Prepare test directory
+		blobStorageDirectory = Files.createTempDir();
+
+		assertTrue(blobStorageDirectory.setExecutable(true, false));
+		assertTrue(blobStorageDirectory.setReadable(true, false));
+		assertTrue(blobStorageDirectory.setWritable(false, false));
+	}
+
+	@After
+	public void after() {
+		// Cleanup test directory
+		assertTrue(blobStorageDirectory.delete());
+	}
+
 	/**
 	 * Verifies that the JobManager fails fast (and with expressive error message)
 	 * when the port to listen is already in use.
@@ -87,7 +113,8 @@ public class JobManagerStartupTest {
 			return;
 		}
 		Configuration failConfig = new Configuration();
-		failConfig.setString(ConfigConstants.BLOB_STORAGE_DIRECTORY_KEY, "/does-not-exist-no-sir");
+		String nonExistDirectory = new File(blobStorageDirectory, DOES_NOT_EXISTS_NO_SIR).getAbsolutePath();
+		failConfig.setString(ConfigConstants.BLOB_STORAGE_DIRECTORY_KEY, nonExistDirectory);
 
 		try {
 			JobManager.runJobManager(failConfig, ExecutionMode.CLUSTER(), "localhost", portNum);


Mime
View raw message