jolshan commented on code in PR #24092:
URL: https://github.com/apache/kafka/pull/24092#discussion_r4484614768


##########
core/src/test/scala/unit/kafka/coordinator/transaction/TransactionMarkerChannelManagerTest.scala:
##########
@@ -400,6 +404,107 @@ class TransactionMarkerChannelManagerTest {
     assertEquals(Map(broker1 -> expectedBroker1Request), secondDrainedRequests)
   }
 
+  @ParameterizedTest
+  @EnumSource(classOf[TransactionResult])
+  def shouldRetryMarkersUntilLeaderEndpointIsAvailable(result: 
TransactionResult): Unit = {
+    mockCache()
+    txnMetadata2.state(if (result == TransactionResult.COMMIT) 
TransactionState.PREPARE_COMMIT else TransactionState.PREPARE_ABORT)
+    val expectedTransition = txnMetadata2.prepareComplete(time.milliseconds())
+    val cache = new KRaftMetadataCache(0, () => KRaftVersion.KRAFT_VERSION_0)
+    val topicId = Uuid.randomUuid()
+    val listenerName = 
ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT)
+
+    // Send the getPartitionLeaderEndpoint request to the real metadata cache.
+    when(metadataCache.getPartitionLeaderEndpoint(
+      anyString(),
+      anyInt(),
+      any[ListenerName]())
+    ).thenAnswer(invocation => {
+      cache.getPartitionLeaderEndpoint(
+        invocation.getArgument(0),
+        invocation.getArgument(1),
+        invocation.getArgument(2))
+    })

Review Comment:
   No you are right. Sorry I'm not looking at the test closely enough.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to