apoorvmittal10 commented on code in PR #14933:
URL: https://github.com/apache/kafka/pull/14933#discussion_r1416635870
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -6922,4 +6923,58 @@ class KafkaApisTest {
val expectedResponse = new
PushTelemetryResponseData().setErrorCode(Errors.INVALID_REQUEST.code)
assertEquals(expectedResponse, response.data)
}
+
+ @Test
+ def testListClientMetricsResourcesNotAllowedForZkClusters(): Unit = {
+ val request = buildRequest(new
ListClientMetricsResourcesRequest.Builder(new
ListClientMetricsResourcesRequestData()).build())
+ createKafkaApis(enableForwarding = true).handle(request,
RequestLocal.NoCaching)
+
+ val response =
verifyNoThrottling[ListClientMetricsResourcesResponse](request)
+ assertEquals(Errors.UNKNOWN_SERVER_ERROR,
Errors.forCode(response.data.errorCode))
Review Comment:
This test covers when KafkaApis is configured in ZK mode and gets rejected
by common `handle` method which throws `new IllegalStateException` which
translates to `UNKNOWN_SERVER_ERROR`.
Then it also makes sense that no handling is needed in
`handleListClientMetricsResources`, as method should always have
`clientMetricsManager` if call reaches to that method. But I completed the
request logically there if `clientMetricsManager` is None to avoid any error
case.
I have added a comment in the code as well.
--
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]