Github user suez1224 commented on a diff in the pull request:
https://github.com/apache/flink/pull/5416#discussion_r176209172
--- Diff:
flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java ---
@@ -465,27 +514,23 @@ private static void start(YarnConfiguration conf,
String principal, String keyta
File flinkConfDirPath = findFile(flinkDistRootDir, new
ContainsName(new String[]{"flink-conf.yaml"}));
Assert.assertNotNull(flinkConfDirPath);
+ org.apache.flink.configuration.Configuration flinkCfg =
+ new
org.apache.flink.configuration.Configuration();
if (!StringUtils.isBlank(principal) &&
!StringUtils.isBlank(keytab)) {
+
//copy conf dir to test temporary workspace
location
tempConfPathForSecureRun =
tmp.newFolder("conf");
String confDirPath =
flinkConfDirPath.getParentFile().getAbsolutePath();
FileUtils.copyDirectory(new File(confDirPath),
tempConfPathForSecureRun);
- try (FileWriter fw = new FileWriter(new
File(tempConfPathForSecureRun, "flink-conf.yaml"), true);
- BufferedWriter bw = new
BufferedWriter(fw);
- PrintWriter out = new PrintWriter(bw)) {
-
- LOG.info("writing keytab: " + keytab +
" and principal: " + principal + " to config file");
- out.println("");
- out.println("#Security Configurations
Auto Populated ");
-
out.println(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key() + ": " + keytab);
-
out.println(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key() + ": " + principal);
- out.println("");
- } catch (IOException e) {
- throw new RuntimeException("Exception
occured while trying to append the security configurations.", e);
- }
+
flinkCfg.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key(), keytab);
+
flinkCfg.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key(), principal);
+ flinkCfg.setString(CoreOptions.MODE.key(),
OLD_MODE);
--- End diff --
flinkConfiguration is instance variable and the method here is static.
---