kl0u commented on a change in pull request #6915: [FLINK-10663][streaming] Fix
NPE when StreamingFileSink is closed without initialization.
URL: https://github.com/apache/flink/pull/6915#discussion_r227746184
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/filesystem/LocalStreamingFileSinkTest.java
##########
@@ -59,6 +59,17 @@ public void testClosingWithoutInput() throws Exception {
}
}
+ @Test
+ public void testClosingWithoutOpenShouldNotFail() throws Exception {
+ final File outDir = TEMP_FOLDER.newFolder();
+
+ try (OneInputStreamOperatorTestHarness<Tuple2<String, Integer>,
Object> testHarness =
+ TestUtils.createRescalingTestSink(outDir, 1,
0, 100L, 124L)
+ ) {
+ testHarness.setup();
+ }
+ }
+
Review comment:
I would rename the test to `testClosingWithoutInitializingStateShouldNotFail
` and also I would not use `try-with-resource` but I would call `close()`
explicitly so that the test is clearer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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