rreddy-22 commented on code in PR #19193:
URL: https://github.com/apache/kafka/pull/19193#discussion_r2001741495
##########
core/src/test/scala/unit/kafka/coordinator/transaction/TransactionCoordinatorTest.scala:
##########
@@ -1070,26 +1146,47 @@ class TransactionCoordinatorTest {
})
// For the first two calls, verify that the epoch was only bumped once
- coordinator.handleInitProducerId(transactionalId, txnTimeoutMs, None,
initProducerIdMockCallback)
+ coordinator.handleInitProducerId(
+ transactionalId,
+ txnTimeoutMs,
+ enableTwoPCFlag = false,
+ keepPreparedTxn = false,
+ None,
+ initProducerIdMockCallback
+ )
assertEquals(InitProducerIdResult(-1, -1, Errors.NOT_ENOUGH_REPLICAS),
result)
assertEquals((producerEpoch + 1).toShort, txnMetadata.producerEpoch)
assertTrue(txnMetadata.hasFailedEpochFence)
- coordinator.handleInitProducerId(transactionalId, txnTimeoutMs, None,
initProducerIdMockCallback)
+ coordinator.handleInitProducerId(
+ transactionalId,
+ txnTimeoutMs,
+ enableTwoPCFlag = false,
+ keepPreparedTxn = false,
+ None,
+ initProducerIdMockCallback
+ )
assertEquals(InitProducerIdResult(-1, -1, Errors.NOT_ENOUGH_REPLICAS),
result)
assertEquals((producerEpoch + 1).toShort, txnMetadata.producerEpoch)
assertTrue(txnMetadata.hasFailedEpochFence)
// For the last, successful call, verify that the epoch was not bumped
further
- coordinator.handleInitProducerId(transactionalId, txnTimeoutMs, None,
initProducerIdMockCallback)
+ coordinator.handleInitProducerId(
+ transactionalId,
+ txnTimeoutMs,
+ enableTwoPCFlag = false,
+ keepPreparedTxn = false,
+ None,
+ initProducerIdMockCallback
+ )
assertEquals(InitProducerIdResult(-1, -1, Errors.CONCURRENT_TRANSACTIONS),
result)
assertEquals((producerEpoch + 1).toShort, txnMetadata.producerEpoch)
assertFalse(txnMetadata.hasFailedEpochFence)
- verify(transactionManager, times(3)).validateTransactionTimeoutMs(anyInt())
+ when(transactionManager.validateTransactionTimeoutMs(anyBoolean(),
anyInt())).thenReturn(true)
Review Comment:
yes, the validateTransactionTimeout method now also takes the boolean flag
enable2PC as a param so had to change it
--
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]