GreatEugenius commented on code in PR #569:
URL: https://github.com/apache/flink-agents/pull/569#discussion_r2944083939
##########
runtime/src/test/java/org/apache/flink/agents/runtime/eventlog/FileEventLoggerTest.java:
##########
@@ -494,6 +495,28 @@ void testDefaultEventFilterBehavior() throws Exception {
assertInstanceOf(OutputEvent.class, outputRecord.getEvent());
}
+ @Test
+ void testPrettyPrintOutputsFormattedJson() throws Exception {
+ // Given - config with prettyPrint enabled
+ config =
+ EventLoggerConfig.builder()
+ .loggerType("file")
+ .property(FileEventLogger.BASE_LOG_DIR_PROPERTY_KEY,
tempDir.toString())
+ .property(AgentConfigOptions.PRETTY_PRINT.getKey(),
true)
+ .build();
+ logger = new FileEventLogger(config);
+
+ logger.open(openParams);
+ InputEvent inputEvent = new InputEvent("test input");
+ logger.append(new EventContext(inputEvent), inputEvent);
+ logger.flush();
+
+ // Then - output should span multiple lines (pretty-printed)
+ Path logFile = getExpectedLogFilePath();
+ String content = Files.readString(logFile);
+ assertTrue(content.contains("\n "), "Pretty-printed JSON should
contain indented lines");
Review Comment:
Good question. I have now updated the assertion for pretty printing from
three divisions:
* Multi-line: The total number of JSON output lines is greater than 1.
* Indentation: There are subsequent lines that start with spaces after the
first line.
* Valid JSON: After concatenating the multi-line content, it can still be
correctly deserialized into an EventLogRecord.
--
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]