tillrohrmann commented on a change in pull request #7020: [FLINK-10774] [Kafka]
connection leak when partition discovery is disabled an…
URL: https://github.com/apache/flink/pull/7020#discussion_r246069474
##########
File path:
flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBaseTest.java
##########
@@ -464,6 +466,34 @@ public void go() throws Exception {
runThread.sync();
}
+ @Test
+ public void testClosePartitionDiscovererWhenOpenThrowException() throws
Exception {
+ final AbstractPartitionDiscoverer mockPartitionDiscoverer =
mock(AbstractPartitionDiscoverer.class);
+ final AtomicBoolean partitionDiscovererClosed = new
AtomicBoolean(false);
+ doAnswer((i) -> {
+ partitionDiscovererClosed.set(true);
+ return null;
+ }).when(mockPartitionDiscoverer).close();
+
+ final DummyFlinkKafkaConsumer<String> consumer = new
DummyFlinkKafkaConsumerThrowExceptionInOpen<>(mockPartitionDiscoverer);
+ consumer.setCommitOffsetsOnCheckpoints(false); // disabling
offset committing should override everything
+
+ try {
+ setupConsumer(
+ consumer,
+ false,
+ null,
+ false, // enable checkpointing; auto commit
should be ignored
+ 0,
+ 1);
Review comment:
`fail` is missing in case that no exception is thrown.
----------------------------------------------------------------
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