Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5953#discussion_r186350834
--- Diff:
flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java
---
@@ -85,21 +91,56 @@ public void checkForProhibitedLogContents() {
public void testDetachedMode() throws InterruptedException, IOException
{
LOG.info("Starting testDetachedMode()");
addTestAppender(FlinkYarnSessionCli.class, Level.INFO);
- Runner runner =
- startWithArgs(new String[]{"-j",
flinkUberjar.getAbsolutePath(),
- "-t",
flinkLibFolder.getAbsolutePath(),
- "-n", "1",
- "-jm", "768",
- "-tm", "1024",
- "--name", "MyCustomName", //
test setting a custom name
- "--detached"},
+
+ File exampleJarLocation =
getTestJarPath("StreamingWordCount.jar");
+ // get temporary file for reading input data for wordcount
example
+ File tmpInFile = tmp.newFile();
+ FileUtils.writeStringToFile(tmpInFile, WordCountData.TEXT);
+
+ ArrayList<String> args = new ArrayList<>();
+ args.add("-j"); args.add(flinkUberjar.getAbsolutePath());
+ args.add("-t"); args.add(flinkLibFolder.getAbsolutePath());
+ args.add("-n"); args.add("1");
+ args.add("-jm"); args.add("768");
+ args.add("-tm"); args.add("1024");
+ if (SecureTestEnvironment.getTestKeytab() != null) {
+ args.add("-D" +
SecurityOptions.KERBEROS_LOGIN_KEYTAB.key() + "=" +
SecureTestEnvironment.getTestKeytab());
+ }
+ if (SecureTestEnvironment.getHadoopServicePrincipal() != null) {
+ args.add("-D" +
SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key() + "=" +
SecureTestEnvironment.getHadoopServicePrincipal());
+ }
+ args.add("--name"); args.add("MyCustomName");
+ args.add("--detached");
+ Runner clusterRunner =
+ startWithArgs(
+ args.toArray(new String[args.size()]),
"Flink JobManager is now running on",
RunTypes.YARN_SESSION);
// before checking any strings outputted by the CLI, first give
it time to return
- runner.join();
- checkForLogString("The Flink YARN client has been started in
detached mode");
+ clusterRunner.join();
if (!isNewMode) {
+ checkForLogString("The Flink YARN client has been
started in detached mode");
+
+ // in legacy mode we have to wait until the TMs are up
until we can submit the job
+ LOG.info("Waiting until two containers are running");
+ // wait until two containers are running
+ while (getRunningContainers() < 2) {
--- End diff --
there a comment at L 151: `// additional sleep for the JM/TM to start and
establish connection`, the job execution should probably happen after that...
---