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

davidarthur 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 1aa24475f11 MINOR: convert AddPartitionsToTxnRequestServerTest to 
KRaft (#17762)
1aa24475f11 is described below

commit 1aa24475f11c42dbfea8a181b309024f26e44ee5
Author: Colin Patrick McCabe <cmcc...@apache.org>
AuthorDate: Tue Nov 12 15:39:28 2024 -0800

    MINOR: convert AddPartitionsToTxnRequestServerTest to KRaft (#17762)
    
    Reviewers: David Arthur <mum...@gmail.com>
---
 .../server/AddPartitionsToTxnRequestServerTest.scala    | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git 
a/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala
 
b/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala
index 74a378995b1..1b35f939619 100644
--- 
a/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala
+++ 
b/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala
@@ -32,9 +32,9 @@ import 
org.apache.kafka.common.requests.FindCoordinatorRequest.CoordinatorType
 import org.apache.kafka.common.requests.{AddPartitionsToTxnRequest, 
AddPartitionsToTxnResponse, FindCoordinatorRequest, FindCoordinatorResponse, 
InitProducerIdRequest, InitProducerIdResponse}
 import org.apache.kafka.server.config.ServerLogConfigs
 import org.junit.jupiter.api.Assertions._
-import org.junit.jupiter.api.{BeforeEach, Test, TestInfo}
+import org.junit.jupiter.api.{BeforeEach, TestInfo}
 import org.junit.jupiter.params.ParameterizedTest
-import org.junit.jupiter.params.provider.{Arguments, MethodSource}
+import org.junit.jupiter.params.provider.{Arguments, MethodSource, ValueSource}
 
 import scala.collection.mutable
 import scala.jdk.CollectionConverters._
@@ -109,9 +109,10 @@ class AddPartitionsToTxnRequestServerTest extends 
BaseRequestTest {
     assertTrue(errors.containsKey(nonExistentTopic))
     assertEquals(Errors.UNKNOWN_TOPIC_OR_PARTITION, 
errors.get(nonExistentTopic))
   }
-  
-  @Test
-  def testOneSuccessOneErrorInBatchedRequest(): Unit = {
+
+  @ParameterizedTest
+  @ValueSource(strings = Array("kraft"))
+  def testOneSuccessOneErrorInBatchedRequest(quorum: String): Unit = {
     val tp0 = new TopicPartition(topic1, 0)
     val transactionalId1 = "foobar"
     val transactionalId2 = "barfoo" // "barfoo" maps to the same transaction 
coordinator
@@ -148,8 +149,9 @@ class AddPartitionsToTxnRequestServerTest extends 
BaseRequestTest {
     assertEquals(expectedErrors, errors)
   }
 
-  @Test
-  def testVerifyOnly(): Unit = {
+  @ParameterizedTest
+  @ValueSource(strings = Array("kraft"))
+  def testVerifyOnly(quorum: String): Unit = {
     val tp0 = new TopicPartition(topic1, 0)
 
     val transactionalId = "foobar"
@@ -172,6 +174,7 @@ class AddPartitionsToTxnRequestServerTest extends 
BaseRequestTest {
     // First find coordinator request creates the state topic, then wait for 
transactional topics to be created.
     connectAndReceive[FindCoordinatorResponse](findCoordinatorRequest, 
brokerSocketServer(brokers.head.config.brokerId))
     TestUtils.waitForAllPartitionsMetadata(brokers, "__transaction_state", 50)
+    TestUtils.ensureConsistentKRaftMetadata(brokers, controllerServer)
     val findCoordinatorResponse = 
connectAndReceive[FindCoordinatorResponse](findCoordinatorRequest, 
brokerSocketServer(brokers.head.config.brokerId))
     val coordinatorId = 
findCoordinatorResponse.data().coordinators().get(0).nodeId()
 

Reply via email to