chia7712 commented on code in PR #17989:
URL: https://github.com/apache/kafka/pull/17989#discussion_r1866530959
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerHeartbeatRequestManagerTest.java:
##########
@@ -602,6 +602,44 @@ public void testHeartbeatResponseOnErrorHandling(final
Errors error, final boole
}
}
+ @Test
+ public void testUnsupportedVersion() {
+ mockErrorResponse(Errors.UNSUPPORTED_VERSION,
Errors.UNSUPPORTED_VERSION.message());
+ ArgumentCaptor<ErrorEvent> errorEventArgumentCaptor =
ArgumentCaptor.forClass(ErrorEvent.class);
+ verify(backgroundEventHandler).add(errorEventArgumentCaptor.capture());
+ ErrorEvent errorEvent = errorEventArgumentCaptor.getValue();
+
+ // UnsupportedApiVersion in HB response without any custom message.
It's considered as new protocol not supported.
+ String hbNotSupportedMsg = "The cluster does not support the new
consumer group protocol. Set group" +
+ ".protocol=classic on the consumer configs to revert to the
classic protocol until the cluster is upgraded.";
+ assertInstanceOf(Errors.UNSUPPORTED_VERSION.exception().getClass(),
errorEvent.error());
+ assertEquals(hbNotSupportedMsg, errorEvent.error().getMessage());
+ clearInvocations(backgroundEventHandler);
+
+ // UnsupportedApiVersion in HB response with custom message. Specific
to required version not present, should
+ // keep the custom message.
+ String hbVersionNotSupportedMsg = "The cluster does not support
resolution of SubscriptionPattern on version 0. " +
Review Comment:
Apologies for the unclear comment. I initially assumed this test case was
intended to verify that the server responds with UNSUPPORTED_VERSION when a
SubscriptionPattern is combined with version 0. However, it appears the test
case is actually used to verify the "custom error message."
In short, please disregard my previous comment. :)
--
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]