chia7712 commented on code in PR #16947:
URL: https://github.com/apache/kafka/pull/16947#discussion_r1726038601
##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -842,6 +842,45 @@ class PlaintextAdminIntegrationTest extends
BaseAdminIntegrationTest {
}
}
+ @ParameterizedTest
+ @ValueSource(strings = Array("zk", "kraft"))
+ def testDescribeConfigsNonexistent(quorum: String): Unit = {
+ client = createAdminClient
+
+ val brokerException = assertThrows(classOf[ExecutionException], () => {
+ client.describeConfigs(Seq(new
ConfigResource(ConfigResource.Type.BROKER, "-1")).asJava).all().get()
+ })
+ assertInstanceOf(classOf[TimeoutException], brokerException.getCause)
+
+ val topicException = assertThrows(classOf[ExecutionException], () => {
+ client.describeConfigs(Seq(new ConfigResource(ConfigResource.Type.TOPIC,
"none_topic")).asJava).all().get()
+ })
+ assertInstanceOf(classOf[UnknownTopicOrPartitionException],
topicException.getCause)
+
+ val brokerLoggerException = assertThrows(classOf[ExecutionException], ()
=> {
+ client.describeConfigs(Seq(new
ConfigResource(ConfigResource.Type.BROKER_LOGGER, "-1")).asJava).all().get()
+ })
+ assertInstanceOf(classOf[TimeoutException], brokerLoggerException.getCause)
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = Array("kraft"))
+ def testDescribeConfigsNonexistentForKraft(quorum: String): Unit = {
+ client = createAdminClient
+
+ assertDoesNotThrow(() => client.describeConfigs(
+ Seq(new ConfigResource(ConfigResource.Type.GROUP,
"none_group")).asJava).all().get())
Review Comment:
could you please check the response content? it should not be empty. for
example:
```scala
val groupResource = new ConfigResource(ConfigResource.Type.GROUP,
"none_group")
assertNotEquals(0, client.describeConfigs(
Seq(groupResource).asJava).all().get().get(groupResource).entries().size())
val configResource = new
ConfigResource(ConfigResource.Type.CLIENT_METRICS, "none_metric")
val result =
client.describeConfigs(Seq(configResource).asJava).all().get().get(configResource)
assertEquals(0, result.entries().size())
```
--
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]