flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject flink git commit: [FLINK-4099] Fix CliFrontendYarnAddressConfigurationTest failures
Date Tue, 28 Jun 2016 08:54:50 GMT
Repository: flink
Updated Branches:
  refs/heads/master a6feea32a -> 76ba2d12d


[FLINK-4099] Fix CliFrontendYarnAddressConfigurationTest failures

This closes #2166


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

Branch: refs/heads/master
Commit: 76ba2d12d46e966696a60b2c547185b4fe90005a
Parents: a6feea3
Author: Robert Metzger <rmetzger@apache.org>
Authored: Mon Jun 27 11:52:40 2016 +0200
Committer: Robert Metzger <rmetzger@apache.org>
Committed: Tue Jun 28 10:54:26 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/flink/client/CliFrontend.java  | 2 +-
 .../flink/yarn/CliFrontendYarnAddressConfigurationTest.java | 8 ++++++++
 .../org/apache/flink/yarn/YARNHighAvailabilityITCase.java   | 3 +--
 .../src/test/java/org/apache/flink/yarn/YarnTestBase.java   | 9 +++++++--
 4 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/76ba2d12/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
index 5c4791b..e5846df 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
@@ -113,7 +113,7 @@ public class CliFrontend {
 	private static final String ACTION_SAVEPOINT = "savepoint";
 
 	// config dir parameters
-	private static final String ENV_CONFIG_DIRECTORY = "FLINK_CONF_DIR";
+	public static final String ENV_CONFIG_DIRECTORY = "FLINK_CONF_DIR";
 	private static final String CONFIG_DIRECTORY_FALLBACK_1 = "../conf";
 	private static final String CONFIG_DIRECTORY_FALLBACK_2 = "conf";
 

http://git-wip-us.apache.org/repos/asf/flink/blob/76ba2d12/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendYarnAddressConfigurationTest.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendYarnAddressConfigurationTest.java
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendYarnAddressConfigurationTest.java
index 217ad3d..24d8aa5 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendYarnAddressConfigurationTest.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/CliFrontendYarnAddressConfigurationTest.java
@@ -29,6 +29,7 @@ import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.GlobalConfiguration;
 import org.apache.flink.configuration.IllegalConfigurationException;
+import org.apache.flink.test.util.TestBaseUtils;
 import org.apache.flink.yarn.cli.FlinkYarnSessionCli;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -53,8 +54,10 @@ import java.lang.reflect.Field;
 import java.net.InetSocketAddress;
 import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
@@ -80,6 +83,11 @@ public class CliFrontendYarnAddressConfigurationTest {
 		PrintStream nullPrinter = new PrintStream(new NullPrint());
 		System.setOut(nullPrinter);
 		System.setErr(nullPrinter);
+
+		// Unset FLINK_CONF_DIR, as this is a precondition for this test to work properly
+		Map<String, String> map = new HashMap<>(System.getenv());
+		map.remove(CliFrontend.ENV_CONFIG_DIRECTORY);
+		TestBaseUtils.setEnv(map);
 	}
 
 	@AfterClass

http://git-wip-us.apache.org/repos/asf/flink/blob/76ba2d12/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNHighAvailabilityITCase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNHighAvailabilityITCase.java
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNHighAvailabilityITCase.java
index 4d45f16..1b7db26 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNHighAvailabilityITCase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNHighAvailabilityITCase.java
@@ -45,7 +45,6 @@ import org.junit.rules.TemporaryFolder;
 import scala.concurrent.duration.FiniteDuration;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 
@@ -79,7 +78,7 @@ public class YARNHighAvailabilityITCase extends YarnTestBase {
 	}
 
 	@AfterClass
-	public static void teardown() throws IOException {
+	public static void teardown() throws Exception {
 		if(zkServer != null) {
 			zkServer.stop();
 		}

http://git-wip-us.apache.org/repos/asf/flink/blob/76ba2d12/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
index 6028d98..8ad5bcb 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
@@ -365,7 +365,7 @@ public abstract class YarnTestBase extends TestLogger {
 			File flinkConfDirPath = findFile(flinkDistRootDir, new ContainsName(new String[]{"flink-conf.yaml"}));
 			Assert.assertNotNull(flinkConfDirPath);
 
-			map.put("FLINK_CONF_DIR", flinkConfDirPath.getParent());
+			map.put(CliFrontend.ENV_CONFIG_DIRECTORY, flinkConfDirPath.getParent());
 
 			File yarnConfFile = writeYarnSiteConfigXML(conf);
 			map.put("YARN_CONF_DIR", yarnConfFile.getParentFile().getAbsolutePath());
@@ -593,7 +593,12 @@ public abstract class YarnTestBase extends TestLogger {
 	// -------------------------- Tear down -------------------------- //
 
 	@AfterClass
-	public static void copyOnTravis() {
+	public static void teardown() throws Exception {
+		// Unset FLINK_CONF_DIR, as it might change the behavior of other tests
+		Map<String, String> map = new HashMap<>(System.getenv());
+		map.remove(CliFrontend.ENV_CONFIG_DIRECTORY);
+		TestBaseUtils.setEnv(map);
+
 		// When we are on travis, we copy the tmp files of JUnit (containing the MiniYARNCluster
log files)
 		// to <flinkRoot>/target/flink-yarn-tests-*.
 		// The files from there are picked up by the ./tools/travis_watchdog.sh script


Mime
View raw message