You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2016/04/06 00:18:10 UTC

kafka git commit: KAFKA-3508: Fix transient SimpleACLAuthorizerTest failures

Repository: kafka
Updated Branches:
  refs/heads/trunk 893e79af8 -> 8218a4a15


KAFKA-3508: Fix transient SimpleACLAuthorizerTest failures

Allows the the maximum retires when writing to zookeeper to be overridden in tests and sets the value to Int.MaxValue to avoid transient failure.

Author: Grant Henke <gr...@gmail.com>

Reviewers: Ismael Juma <is...@juma.me.uk>, Ewen Cheslack-Postava <ew...@confluent.io>

Closes #1156 from granthenke/transient-acl-test


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/8218a4a1
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/8218a4a1
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/8218a4a1

Branch: refs/heads/trunk
Commit: 8218a4a153d9138f29486e74cf77c88d1786997a
Parents: 893e79a
Author: Grant Henke <gr...@gmail.com>
Authored: Tue Apr 5 15:17:46 2016 -0700
Committer: Ewen Cheslack-Postava <me...@ewencp.org>
Committed: Tue Apr 5 15:17:46 2016 -0700

----------------------------------------------------------------------
 .../main/scala/kafka/security/auth/SimpleAclAuthorizer.scala   | 2 +-
 .../unit/kafka/security/auth/SimpleAclAuthorizerTest.scala     | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/8218a4a1/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
index 1a06af2..18fff45 100644
--- a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
+++ b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala
@@ -79,7 +79,7 @@ class SimpleAclAuthorizer extends Authorizer with Logging {
 
   // The maximum number of times we should try to update the resource acls in zookeeper before failing;
   // This should never occur, but is a safeguard just in case.
-  private val maxUpdateRetries = 10
+  protected[auth] var maxUpdateRetries = 10
 
   private val retryBackoffMs = 100
   private val retryBackoffJitterMs = 50

http://git-wip-us.apache.org/repos/asf/kafka/blob/8218a4a1/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 bdadb15..7fcc33d 100644
--- a/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
+++ b/core/src/test/scala/unit/kafka/security/auth/SimpleAclAuthorizerTest.scala
@@ -44,6 +44,10 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
   override def setUp() {
     super.setUp()
 
+    // Increase maxUpdateRetries to avoid transient failures
+    simpleAclAuthorizer.maxUpdateRetries = Int.MaxValue
+    simpleAclAuthorizer2.maxUpdateRetries = Int.MaxValue
+
     val props = TestUtils.createBrokerConfig(0, zkConnect)
     props.put(SimpleAclAuthorizer.SuperUsersProp, superUsers)
 
@@ -307,7 +311,7 @@ class SimpleAclAuthorizerTest extends ZooKeeperTestHarness {
   def testHighConcurrencyModificationOfResourceAcls() {
     val commonResource = new Resource(Topic, "test")
 
-    val acls = (0 to 100).map { i =>
+    val acls = (0 to 50).map { i =>
       val useri = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, i.toString)
       new Acl(useri, Allow, WildCardHost, Read)
     }