kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch trunk updated: MINOR: Ensure consumers are closed in DynamicBrokerReconfigurationTest (#5750)
Date Fri, 05 Oct 2018 18:32:09 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 62f9b64  MINOR: Ensure consumers are closed in DynamicBrokerReconfigurationTest (#5750)
62f9b64 is described below

commit 62f9b64f11a08bbacb6d5a0585e3285add1590cf
Author: Jason Gustafson <jason@confluent.io>
AuthorDate: Fri Oct 5 11:31:05 2018 -0700

    MINOR: Ensure consumers are closed in DynamicBrokerReconfigurationTest (#5750)
    
    In `ConsumerBuilder.build`, if `awaitInitialPositions` raises an exception, the consumer
will not be closed properly. We should add the consumer instance to the `consumers` collection
immediately after construction.
    
    Reviewers: Guozhang Wang <wangguoz@gmail.com>
---
 .../integration/kafka/server/DynamicBrokerReconfigurationTest.scala    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
index 5d15cc4..ff4ccef 100644
--- a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
+++ b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala
@@ -1419,10 +1419,11 @@ class DynamicBrokerReconfigurationTest extends ZooKeeperTestHarness
with SaslSet
       consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, _enableAutoCommit.toString)
 
       val consumer = new KafkaConsumer[String, String](consumerProps, new StringDeserializer,
new StringDeserializer)
+      consumers += consumer
+
       consumer.subscribe(Collections.singleton(_topic))
       if (_autoOffsetReset == "latest")
         awaitInitialPositions(consumer)
-      consumers += consumer
       consumer
     }
   }


Mime
View raw message