Vincent-Woo commented on code in PR #25653:
URL: https://github.com/apache/flink/pull/25653#discussion_r1846399994
##########
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/SystemOutRedirectionUtilsTest.java:
##########
@@ -77,26 +76,42 @@ void testDefaultSystemOutAndErr() {
assertThat(errStream.toString()).isEqualTo(logContext);
}
- @ParameterizedTest
- @EnumSource(
- value = SystemOutMode.class,
- names = {"IGNORE", "LOG"})
- void testSystemOutAndErrAreRedirected(SystemOutMode systemOutMode) {
+ @Test
+ void testSystemOutAndErrAreRedirectedToLog() {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ ByteArrayOutputStream errStream = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(outStream));
+ System.setErr(new PrintStream(errStream));
+
+ Configuration conf = new Configuration();
+ conf.set(TASK_MANAGER_SYSTEM_OUT_MODE, SystemOutMode.LOG);
+ SystemOutRedirectionUtils.redirectSystemOutAndError(conf);
+
+ String logContext = "This is log context!";
+ System.out.print(logContext);
+
assertThat(outStream.toString()).isEqualTo(SystemOutRedirectionUtils.OUT_TO_LOG_TIPS);
+
+ System.err.print(logContext);
+
assertThat(errStream.toString()).isEqualTo(SystemOutRedirectionUtils.ERR_TO_LOG_TIPS);
+ }
+
+ @Test
+ void testSystemOutAndErrAreRedirectedToIgnore() {
Review Comment:
@1996fanrui Thanks for the guidance, I made some changes, PTAL
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]