You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Rancho-7 (via GitHub)" <gi...@apache.org> on 2025/03/03 02:53:30 UTC

[PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Rancho-7 opened a new pull request, #19075:
URL: https://github.com/apache/kafka/pull/19075

   jira: https://issues.apache.org/jira/browse/KAFKA-18867
   
   Describing topic configs for default configs is disallowed, but we lack a test for this.
   
   


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "frankvicky (via GitHub)" <gi...@apache.org>.
frankvicky commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1976936643


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))

Review Comment:
   nit: `List.of`



##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))

Review Comment:
   Could you please refactor the variable by using `var`?
   In this way, we could eliminate confusing variables such as `describeResultX.`



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1976887477


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))
+
+    assertTrue(assertThrows(classOf[ExecutionException], () => describeResult0.values.get(defaultTopic).get).getCause.isInstanceOf[InvalidTopicException])

Review Comment:
   could you please leverage `assertFutureThrows`?
   ```
   org.apache.kafka.test.TestUtils.assertFutureThrows(classOf[InvalidTopicException], describeResult0.all())
   ```
   
   both line#1637 and line#1642 can get fixed 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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #19075:
URL: https://github.com/apache/kafka/pull/19075


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1977584859


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))

Review Comment:
   Thanks for the suggestion! I agree that would make the code cleaner. Fixed it.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1977584859


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))

Review Comment:
   Thanks for the suggestion! I agree that would make the code cleaner.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1977580342


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))
+
+    assertTrue(assertThrows(classOf[ExecutionException], () => describeResult0.values.get(defaultTopic).get).getCause.isInstanceOf[InvalidTopicException])

Review Comment:
   Thanks for the review! Fixed it.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-18867: add tests to describe topic configs with empty name [kafka]

Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #19075:
URL: https://github.com/apache/kafka/pull/19075#discussion_r1977580342


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -1626,6 +1626,11 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val existingTopic = new ConfigResource(ConfigResource.Type.TOPIC, topic)
     client.describeConfigs(Collections.singletonList(existingTopic)).values.get(existingTopic).get()
 
+    val defaultTopic = new ConfigResource(ConfigResource.Type.TOPIC, "")
+    val describeResult0 = client.describeConfigs(Collections.singletonList(defaultTopic))
+
+    assertTrue(assertThrows(classOf[ExecutionException], () => describeResult0.values.get(defaultTopic).get).getCause.isInstanceOf[InvalidTopicException])

Review Comment:
   Thanks for the review! I will try to fix it in this way.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org