提交 76ba2d12 编写于 作者: R Robert Metzger

[FLINK-4099] Fix CliFrontendYarnAddressConfigurationTest failures

This closes #2166
上级 a6feea32
......@@ -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";
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册