dajac commented on code in PR #22238:
URL: https://github.com/apache/kafka/pull/22238#discussion_r3214481119
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -1502,33 +1502,56 @@ class KafkaApisTest extends Logging {
checkInvalidPartition(1) // topic has only one partition
}
- @Test
- def testHandleTxnOffsetCommitRequest(): Unit = {
- addTopicToMetadataCache("foo", numPartitions = 1)
+ @ParameterizedTest
+ @ApiKeyVersionsSource(apiKey = ApiKeys.TXN_OFFSET_COMMIT)
+ def testHandleTxnOffsetCommitRequest(version: Short): Unit = {
+ val topicName = "foo"
+ val topicId = Uuid.randomUuid()
+ addTopicToMetadataCache(topicName, topicId = topicId, numPartitions = 1)
val txnOffsetCommitRequest = new TxnOffsetCommitRequestData()
.setGroupId("group")
- .setMemberId("member")
- .setGenerationIdOrMemberEpoch(10)
+ .setMemberId(if (version >= 3) "member" else "")
+ .setGenerationIdOrMemberEpoch(if (version >= 3) 10 else -1)
.setProducerId(20)
.setProducerEpoch(30)
- .setGroupInstanceId("instance-id")
+ .setGroupInstanceId(if (version >= 3) "instance-id" else null)
.setTransactionalId("transactional-id")
.setTopics(util.List.of(
new TxnOffsetCommitRequestData.TxnOffsetCommitRequestTopic()
- .setName("foo")
+ .setTopicId(topicId)
+ .setName(topicName)
Review Comment:
It is actually not needed because the fields are ignorable. For the context,
the request is serialized/deserialized before hitting the KafkaApis in the
tests (see `buildRequest`). I will clean the `testHandleOffsetCommitRequest*`
tests separately.
--
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]