This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/2.4 by this push:
     new a5d21fa  KAFKA-9069: Flaky Test 
AdminClientIntegrationTest.testCreatePartitions
a5d21fa is described below

commit a5d21faf4e2d308828153be2576026f5dfe11f32
Author: Manikumar Reddy <[email protected]>
AuthorDate: Fri Nov 29 21:00:10 2019 +0530

    KAFKA-9069: Flaky Test AdminClientIntegrationTest.testCreatePartitions
    
    https://issues.apache.org/jira/browse/KAFKA-9069
    
    Make `getTopicMetadata` in AdminClientIntegrationTest always read metadata 
from controller to get a consistent view.
    
    Reviewers: Guozhang Wang <[email protected]>, José Armando García Sancio 
<[email protected]>
    
    Closes #7619 from huxihx/KAFKA-9069
---
 .../scala/integration/kafka/api/AdminClientIntegrationTest.scala  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala 
b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
index ad0a78e..c899719 100644
--- a/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
+++ b/core/src/test/scala/integration/kafka/api/AdminClientIntegrationTest.scala
@@ -565,7 +565,7 @@ class AdminClientIntegrationTest extends 
IntegrationTestHarness with Logging {
       getTopicMetadata(client, topic, expectedNumPartitionsOpt = 
expectedNumPartitionsOpt).partitions
     }
 
-    def numPartitions(topic: String): Int = partitions(topic).size
+    def numPartitions(topic: String, expectedNumPartitionsOpt: Option[Int] = 
None): Int = partitions(topic, expectedNumPartitionsOpt).size
 
     // validateOnly: try creating a new partition (no assignments), to bring 
the total to 3 partitions
     var alterResult = client.createPartitions(Map(topic1 ->
@@ -622,7 +622,7 @@ class AdminClientIntegrationTest extends 
IntegrationTestHarness with Logging {
         case e: ExecutionException =>
           assertTrue(desc, e.getCause.isInstanceOf[InvalidPartitionsException])
           assertEquals(desc, "Topic already has 3 partitions.", 
e.getCause.getMessage)
-          assertEquals(desc, 3, numPartitions(topic2))
+          assertEquals(desc, 3, numPartitions(topic2, Some(3)))
       }
 
       // try a newCount which would be a noop (where the assignment matches 
current state)
@@ -634,7 +634,7 @@ class AdminClientIntegrationTest extends 
IntegrationTestHarness with Logging {
         case e: ExecutionException =>
           assertTrue(desc, e.getCause.isInstanceOf[InvalidPartitionsException])
           assertEquals(desc, "Topic already has 3 partitions.", 
e.getCause.getMessage)
-          assertEquals(desc, 3, numPartitions(topic2))
+          assertEquals(desc, 3, numPartitions(topic2, Some(3)))
       }
 
       // try a newCount which would be a noop (where the assignment doesn't 
match current state)
@@ -646,7 +646,7 @@ class AdminClientIntegrationTest extends 
IntegrationTestHarness with Logging {
         case e: ExecutionException =>
           assertTrue(desc, e.getCause.isInstanceOf[InvalidPartitionsException])
           assertEquals(desc, "Topic already has 3 partitions.", 
e.getCause.getMessage)
-          assertEquals(desc, 3, numPartitions(topic2))
+          assertEquals(desc, 3, numPartitions(topic2, Some(3)))
       }
 
       // try a bad topic name

Reply via email to