jeffkbkim commented on code in PR #18749:
URL: https://github.com/apache/kafka/pull/18749#discussion_r1935896162
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupCoordinatorRecordSerdeTest.java:
##########
@@ -198,6 +198,34 @@ public void testDeserializeWithInvalidValueBytes() {
ex.getMessage());
}
+ @Test
+ public void testDeserializeWithInvalidValueVersion() {
+ GroupCoordinatorRecordSerde serde = new GroupCoordinatorRecordSerde();
+
+ ApiMessage key = new ConsumerGroupMetadataKey().setGroupId("foo");
+ ByteBuffer keyBuffer =
MessageUtil.toCoordinatorTypePrefixedByteBuffer(key);
+
+ ByteBuffer valueBuffer1 = ByteBuffer.allocate(2);
+ valueBuffer1.putShort((short)
(ConsumerGroupMetadataValue.HIGHEST_SUPPORTED_VERSION + 1));
+ valueBuffer1.rewind();
+
+ Deserializer.UnknownRecordVersionException ex =
+ assertThrows(Deserializer.UnknownRecordVersionException.class,
+ () -> serde.deserialize(keyBuffer, valueBuffer1));
+ assertEquals(key.apiKey(), ex.type());
+ assertEquals(ConsumerGroupMetadataValue.HIGHEST_SUPPORTED_VERSION + 1,
ex.unknownVersion());
+
+ keyBuffer.rewind();
+ ByteBuffer valueBuffer2 = ByteBuffer.allocate(2);
+ valueBuffer2.putShort((short)
(ConsumerGroupMetadataValue.HIGHEST_SUPPORTED_VERSION - 1));
Review Comment:
should this be LOWEST_SUPPORTED_VERSION - 1? also in L226
--
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]