jolshan commented on code in PR #14120: URL: https://github.com/apache/kafka/pull/14120#discussion_r1300505047
########## group-coordinator/src/test/java/org/apache/kafka/coordinator/group/OffsetMetadataManagerTest.java: ########## @@ -1040,6 +1089,342 @@ public void testConsumerGroupOffsetCommitWithOffsetMetadataTooLarge() { ); } + @Test + public void testGenericGroupFetchOffsetsWithDeadGroup() { + OffsetMetadataManagerTestContext context = new OffsetMetadataManagerTestContext.Builder().build(); + + // Create a dead group. + GenericGroup group = context.groupMetadataManager.getOrMaybeCreateGenericGroup( + "group", + true + ); + group.transitionTo(GenericGroupState.DEAD); + + List<OffsetFetchRequestData.OffsetFetchRequestTopics> request = Arrays.asList( + new OffsetFetchRequestData.OffsetFetchRequestTopics() + .setName("foo") + .setPartitionIndexes(Arrays.asList(0, 1)), + new OffsetFetchRequestData.OffsetFetchRequestTopics() + .setName("bar") + .setPartitionIndexes(Collections.singletonList(0)) + ); + + List<OffsetFetchResponseData.OffsetFetchResponseTopics> expectedResponse = Arrays.asList( + new OffsetFetchResponseData.OffsetFetchResponseTopics() + .setName("foo") + .setPartitions(Arrays.asList( + mkInvalidOffsetPartitionResponse(0), + mkInvalidOffsetPartitionResponse(1) + )), + new OffsetFetchResponseData.OffsetFetchResponseTopics() + .setName("bar") + .setPartitions(Collections.singletonList( + mkInvalidOffsetPartitionResponse(0) + )) + ); + + assertEquals(expectedResponse, context.fetchOffsets("group", request, Long.MAX_VALUE)); + } + + @Test + public void testFetchOffsetsWithUnknownGroup() { + OffsetMetadataManagerTestContext context = new OffsetMetadataManagerTestContext.Builder().build(); + + List<OffsetFetchRequestData.OffsetFetchRequestTopics> request = Arrays.asList( + new OffsetFetchRequestData.OffsetFetchRequestTopics() + .setName("foo") + .setPartitionIndexes(Arrays.asList(0, 1)), + new OffsetFetchRequestData.OffsetFetchRequestTopics() + .setName("bar") + .setPartitionIndexes(Collections.singletonList(0)) + ); + + List<OffsetFetchResponseData.OffsetFetchResponseTopics> expectedResponse = Arrays.asList( + new OffsetFetchResponseData.OffsetFetchResponseTopics() + .setName("foo") + .setPartitions(Arrays.asList( + mkInvalidOffsetPartitionResponse(0), + mkInvalidOffsetPartitionResponse(1) + )), + new OffsetFetchResponseData.OffsetFetchResponseTopics() + .setName("bar") + .setPartitions(Collections.singletonList( + mkInvalidOffsetPartitionResponse(0) + )) + ); + + assertEquals(expectedResponse, context.fetchOffsets("group", request, Long.MAX_VALUE)); + } + + @Test + public void testFetchOffsetsWithCommittedAndUncommittedData() { Review Comment: why do we call this test and the equivalent fetch all offsets "withCommittedAndUncommittedData"? Isn't the data all committed? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org