You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2017/05/13 07:07:42 UTC
kafka git commit: MINOR: Close ZooKeeper clients in a couple of tests
Repository: kafka
Updated Branches:
refs/heads/trunk 9198467eb -> 6a5026b23
MINOR: Close ZooKeeper clients in a couple of tests
Author: Rajini Sivaram <ra...@googlemail.com>
Reviewers: Ismael Juma <is...@juma.me.uk>
Closes #3039 from rajinisivaram/MINOR-close-zkclient
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/6a5026b2
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/6a5026b2
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/6a5026b2
Branch: refs/heads/trunk
Commit: 6a5026b23bec5207105d498f784872a3d2dd1e72
Parents: 9198467
Author: Rajini Sivaram <ra...@googlemail.com>
Authored: Sat May 13 03:44:49 2017 +0100
Committer: Ismael Juma <is...@juma.me.uk>
Committed: Sat May 13 08:07:30 2017 +0100
----------------------------------------------------------------------
.../kafka/admin/ListConsumerGroupTest.scala | 6 +++++-
.../security/auth/SimpleAclAuthorizerTest.scala | 21 ++++++++++++++------
2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/6a5026b2/core/src/test/scala/unit/kafka/admin/ListConsumerGroupTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/admin/ListConsumerGroupTest.scala b/core/src/test/scala/unit/kafka/admin/ListConsumerGroupTest.scala
index 8759cfd..c03be66 100644
--- a/core/src/test/scala/unit/kafka/admin/ListConsumerGroupTest.scala
+++ b/core/src/test/scala/unit/kafka/admin/ListConsumerGroupTest.scala
@@ -55,7 +55,11 @@ class ListConsumerGroupTest extends KafkaServerTestHarness {
def testListGroupWithNoExistingGroup() {
val opts = new ConsumerGroupCommandOptions(Array("--zookeeper", zkConnect))
val consumerGroupCommand = new ZkConsumerGroupService(opts)
- assert(consumerGroupCommand.listGroups().isEmpty)
+ try {
+ assert(consumerGroupCommand.listGroups().isEmpty)
+ } finally {
+ consumerGroupCommand.close()
+ }
}
@Test
http://git-wip-us.apache.org/repos/asf/kafka/blob/6a5026b2/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala b/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
index 0765992..6017a7b 100644
--- a/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
+++ b/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
@@ -61,6 +61,7 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
override def tearDown(): Unit = {
simpleAclAuthorizer.close()
simpleAclAuthorizer2.close()
+ super.tearDown()
}
@Test
@@ -189,9 +190,13 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
props.put(SimpleAclAuthorizer.AllowEveryoneIfNoAclIsFoundProp, "true")
val cfg = KafkaConfig.fromProps(props)
- val testAuthoizer: SimpleAclAuthorizer = new SimpleAclAuthorizer
- testAuthoizer.configure(cfg.originals)
- assertTrue("when acls = null or [], authorizer should fail open with allow.everyone = true.", testAuthoizer.authorize(session, Read, resource))
+ val testAuthorizer = new SimpleAclAuthorizer
+ try {
+ testAuthorizer.configure(cfg.originals)
+ assertTrue("when acls = null or [], authorizer should fail open with allow.everyone = true.", testAuthorizer.authorize(session, Read, resource))
+ } finally {
+ testAuthorizer.close()
+ }
}
@Test
@@ -255,10 +260,14 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
zkUtils.deletePathRecursive(SimpleAclAuthorizer.AclChangedZkPath)
val authorizer = new SimpleAclAuthorizer
- authorizer.configure(config.originals)
+ try {
+ authorizer.configure(config.originals)
- assertEquals(acls, authorizer.getAcls(resource))
- assertEquals(acls1, authorizer.getAcls(resource1))
+ assertEquals(acls, authorizer.getAcls(resource))
+ assertEquals(acls1, authorizer.getAcls(resource1))
+ } finally {
+ authorizer.close()
+ }
}
@Test