KarmaGYZ commented on a change in pull request #10804: [FLINK-15488] Obtain the
JVM and TM param correctly
URL: https://github.com/apache/flink/pull/10804#discussion_r365253539
##########
File path:
flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java
##########
@@ -34,21 +36,30 @@
private static final String RUN_BASH_JAVA_UTILS_CMD_SCRIPT =
"src/test/bin/runBashJavaUtilsCmd.sh";
+ /**
+ * Executes the given shell script wrapper and returns the last line.
+ */
+ private String executeScriptAndFetchLastLine(final String command)
throws IOException {
+ String[] commands = {RUN_BASH_JAVA_UTILS_CMD_SCRIPT, command};
+ String[] lines =
executeScript(commands).split(System.lineSeparator());
+ if (lines.length == 0) {
+ return "";
+ } else {
+ return lines[lines.length - 1];
+ }
+ }
+
@Test
public void testGetTmResourceDynamicConfigs() throws Exception {
- String[] command = {RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
-
BashJavaUtils.Command.GET_TM_RESOURCE_DYNAMIC_CONFIGS.toString()};
- String result = executeScript(command);
+ String result =
executeScriptAndFetchLastLine(BashJavaUtils.Command.GET_TM_RESOURCE_DYNAMIC_CONFIGS.toString());
assertNotNull(result);
Review comment:
Yes indeed. Currently, the test case here is more like an end-to-end test.
However, I think it's necessary to test the bash function. What do you think is
the best way to cover those code path?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services