kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-3728; EndToEndAuthorizationTest offsets_topic misconfigured
Date Fri, 03 Jun 2016 20:31:32 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 234fa5a69 -> 49ddc897b


KAFKA-3728; EndToEndAuthorizationTest offsets_topic misconfigured

Set OffsetsTopicReplicationFactorProp to 3 like MinInSyncReplicasProp  Else a consumer was
able to consume via assign but not via subscribe, so the testProduceAndConsume is now duplicated
to check both paths

Author: Edoardo Comar <ecomar@uk.ibm.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #1425 from edoardocomar/KAFKA-3728


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

Branch: refs/heads/trunk
Commit: 49ddc897b8feda9c4786d5bcd03814b91ede7124
Parents: 234fa5a
Author: Edoardo Comar <ecomar@uk.ibm.com>
Authored: Fri Jun 3 21:31:27 2016 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Fri Jun 3 21:31:27 2016 +0100

----------------------------------------------------------------------
 .../kafka/api/EndToEndAuthorizationTest.scala   | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/49ddc897/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala
index e13f160..05d8dc5 100644
--- a/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala
+++ b/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala
@@ -132,7 +132,7 @@ trait EndToEndAuthorizationTest extends IntegrationTestHarness with SaslSetup
{
   this.serverConfig.setProperty(KafkaConfig.AuthorizerClassNameProp, classOf[SimpleAclAuthorizer].getName)
   // Some needed configuration for brokers, producers, and consumers
   this.serverConfig.setProperty(KafkaConfig.OffsetsTopicPartitionsProp, "1")
-  this.serverConfig.setProperty(KafkaConfig.OffsetsTopicReplicationFactorProp, "1")
+  this.serverConfig.setProperty(KafkaConfig.OffsetsTopicReplicationFactorProp, "3")
   this.serverConfig.setProperty(KafkaConfig.MinInSyncReplicasProp, "3")
   this.consumerConfig.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "group")
 
@@ -169,7 +169,22 @@ trait EndToEndAuthorizationTest extends IntegrationTestHarness with SaslSetup
{
     * Tests the ability of producing and consuming with the appropriate ACLs set.
     */
   @Test
-  def testProduceConsume {
+  def testProduceConsumeViaAssign {
+    setAclsAndProduce()
+    consumers.head.assign(List(tp).asJava)
+    consumeRecords(this.consumers.head, numRecords)
+    debug("Finished consuming")
+  }
+
+  @Test
+  def testProduceConsumeViaSubscribe {
+    setAclsAndProduce()
+    consumers.head.subscribe(List(topic).asJava)
+    consumeRecords(this.consumers.head, numRecords)
+    debug("Finished consuming")
+  }
+
+  private def setAclsAndProduce() {
     AclCommand.main(produceAclArgs)
     AclCommand.main(consumeAclArgs)
     servers.foreach(s => {
@@ -181,9 +196,6 @@ trait EndToEndAuthorizationTest extends IntegrationTestHarness with SaslSetup
{
     sendRecords(numRecords, tp)
     //Consume records
     debug("Finished sending and starting to consume records")
-    consumers.head.assign(List(tp).asJava)
-    consumeRecords(this.consumers.head, numRecords)
-    debug("Finished consuming")
   }
 
   /**


Mime
View raw message