IgnacioAcunaF commented on a change in pull request #10858:
URL: https://github.com/apache/kafka/pull/10858#discussion_r652249976



##########
File path: core/src/test/scala/unit/kafka/admin/ConsumerGroupServiceTest.scala
##########
@@ -110,6 +132,12 @@ class ConsumerGroupServiceTest {
     AdminClientTestUtils.listConsumerGroupOffsetsResult(offsets)
   }
 
+  private def listGroupNegativeOffsetsResult: ListConsumerGroupOffsetsResult = 
{
+    // Half of the partitions of the testing topics are set to have a negative 
integer offset (null value [KAFKA-9507 for reference])
+    val offsets = topicPartitions.zipWithIndex.map{ case (tp, i) => tp -> ( 
if(i % 2 == 0) null else new OffsetAndMetadata(100) ) }.toMap.asJava

Review comment:
       Yes. I am generating explicitly the test cases on the function, like 
something like this (work in progress):
   
   
   ```
     def testAdminRequestsForDescribeNegativeOffsets(): Unit = {
       val args = Array("--bootstrap-server", "localhost:9092", "--group", 
group, "--describe", "--offsets")
       val groupService = consumerGroupService(args)
   
       val testTopicPartition0 = new TopicPartition("testTopic", 0);
       val testTopicPartition1 = new TopicPartition("testTopic", 1);
       val testTopicPartition2 = new TopicPartition("testTopic", 2);
       val testTopicPartition3 = new TopicPartition("testTopic", 3);
       val testTopicPartition4 = new TopicPartition("testTopic", 4);
       val testTopicPartition5 = new TopicPartition("testTopic", 5);
       val testTopicPartition6 = new TopicPartition("testTopic", 6);
       val testTopicPartition7 = new TopicPartition("testTopic", 7);
       val testTopicPartition8 = new TopicPartition("testTopic", 8);
       val testTopicPartition9 = new TopicPartition("testTopic", 9);
   
       val offsets = Map(
         testTopicPartition0 -> new OffsetAndMetadata(100),
         testTopicPartition1 -> new OffsetAndMetadata(100),
         testTopicPartition2 -> new OffsetAndMetadata(100),
         testTopicPartition3 -> new OffsetAndMetadata(100),
         testTopicPartition4 -> new OffsetAndMetadata(100),
         testTopicPartition5 -> new OffsetAndMetadata(100),
         testTopicPartition6 -> new OffsetAndMetadata(100),
         testTopicPartition7 -> new OffsetAndMetadata(100),
         testTopicPartition8 -> new OffsetAndMetadata(100),
         testTopicPartition9 -> null,
       ).asJava
   ```
   Does this makes sense?




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to