You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/06/17 14:56:00 UTC

[GitHub] [kafka] dajac commented on a change in pull request #8853: KAFKA-10147 MockAdminClient#describeConfigs(Collection
dajac commented on a change in pull request #8853:
URL: https://github.com/apache/kafka/pull/8853#discussion_r441609880



##########
File path: clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java
##########
@@ -560,10 +529,15 @@ synchronized private Config getResourceDescription(ConfigResource resource) {
             }
             case TOPIC: {
                 TopicMetadata topicMetadata = allTopics.get(resource.name());
-                if (topicMetadata == null) {
-                    throw new UnknownTopicOrPartitionException();
+                if (topicMetadata != null && !topicMetadata.markedForDeletion) {
+                    if (topicMetadata.fetchesRemainingUntilVisible > 0)
+                        topicMetadata.fetchesRemainingUntilVisible = Math.max(0, topicMetadata.fetchesRemainingUntilVisible - 1);
+                    else return new Config(topicMetadata.configs.entrySet().stream()
+                                .map(entry -> new ConfigEntry(entry.getKey(), entry.getValue()))
+                                .collect(Collectors.toList()));

Review comment:
       nit: I think that we can use `toConfigObject(topicMetadata.configs)` here.




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

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