You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "xijiu (via GitHub)" <gi...@apache.org> on 2024/08/21 13:51:10 UTC

[PR] KAFKA-17359: Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource [kafka]

xijiu opened a new pull request, #16947:
URL: https://github.com/apache/kafka/pull/16947

   As title.
   
   1. The different behavior of nonexistent resource. For example: nonexistent broker will cause timeout; nonexistent topic will produce `UnknownTopicOrPartitionException`; nonexistent group will return static/default configs; client_metrics will return empty configs
   2. `The resources (topic and broker resource types are currently supported)` this description is out-of-date
   3. Add some junit test
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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-17359: Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource [kafka]

Posted by "xijiu (via GitHub)" <gi...@apache.org>.
xijiu commented on PR #16947:
URL: https://github.com/apache/kafka/pull/16947#issuecomment-2304606218

   @chia7712   Thanks for the code review, I have fixed it, PTAL   


-- 
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-17359: Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16947:
URL: https://github.com/apache/kafka/pull/16947#issuecomment-2305471500

   ```
   ./gradlew cleanTest :streams:test --tests AdjustStreamThreadCountTest.shouldAddStreamThread --tests AdjustStreamThreadCountTest.testRebalanceHappensBeforeStreamThreadGetDown --tests EosIntegrationTest.shouldCheckpointRestoredOffsetsWhenClosingCleanDuringRestoringStateUpdaterDisabled --tests AdjustStreamThreadCountTest.shouldRemoveStreamThreadWithStaticMembership --tests AdjustStreamThreadCountTest.shouldResizeCacheAfterThreadRemovalTimesOut --tests EmitOnChangeIntegrationTest.shouldEmitSameRecordAfterFailover --tests HighAvailabilityTaskAssignorIntegrationTest.shouldScaleOutWithWarmupTasksAndPersistentStores :tools:test --tests LeaderElectionCommandTest.testAllTopicPartition --tests GetOffsetShellTest.testTopicPartitionsArg :storage:test --tests DeleteSegmentsByRetentionSizeTest.executeTieredStorageTest --tests DisableRemoteLogOnTopicTest.executeTieredStorageTest --tests TopicBasedRemoteLogMetadataManagerMultipleSubscriptionsTest.testMultiplePartitionSubscriptions --tests TopicBas
 edRemoteLogMetadataManagerTest.testDoesTopicExist --tests FetchFromLeaderWithCorruptedCheckpointTest.executeTieredStorageTest --tests ReassignReplicaExpandTest.executeTieredStorageTest --tests ReassignReplicaShrinkTest.executeTieredStorageTest :connect:runtime:test --tests BlockingConnectorTest.testBlockInSinkTaskStart --tests ConnectWorkerIntegrationTest.testBrokerCoordinator :metadata:test --tests QuorumControllerTest.testFenceMultipleBrokers :connect:mirror:test --tests DedicatedMirrorIntegrationTest.testSingleNodeCluster --tests IdentityReplicationIntegrationTest.testReplicationWithoutOffsetSyncWillNotCreateOffsetSyncsTopic :core:test --tests ConsumerBounceTest.testConsumptionWithBrokerFailures --tests ShareGroupHeartbeatRequestTest.testPartitionAssignmentWithChangingTopics --tests ZkMigrationFailoverTest.testDriverSkipsEventsFromOlderEpoch :connect:file:test --tests FileStreamSinkConnectorIntegrationTest.testAlterOffsets --tests FileStreamSourceConnectorIntegrationTest.testAlte
 rOffsets
   ```
   the failed tests pass on my local. will merge 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-17359: Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-17359: Add tests and enhance the docs of `Admin#describeConfigs` for the case of nonexistent resource [kafka]

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


-- 
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