stevenzwu 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_r250397468
 
 

 ##########
 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:
   good batch. fixed

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to