You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by di...@apache.org on 2024/01/04 21:15:57 UTC
(kafka) branch trunk updated: MINOR: Prevent java.lang.UnsupportedOperationException in MockAdminClient (#14955)
This is an automated email from the ASF dual-hosted git repository.
divijv pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 29108b67016 MINOR: Prevent java.lang.UnsupportedOperationException in MockAdminClient (#14955)
29108b67016 is described below
commit 29108b6701624c0640871272e5b069773f06f69c
Author: James Faulkner <ja...@users.noreply.github.com>
AuthorDate: Thu Jan 4 21:15:51 2024 +0000
MINOR: Prevent java.lang.UnsupportedOperationException in MockAdminClient (#14955)
Reviewers: Divij Vaidya <di...@amazon.com>, Sagar Rao <sa...@gmail.com>
---
.../test/java/org/apache/kafka/clients/admin/MockAdminClient.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java b/clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java
index 192eb6649a2..239e8b728d5 100644
--- a/clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java
+++ b/clients/src/test/java/org/apache/kafka/clients/admin/MockAdminClient.java
@@ -1017,7 +1017,13 @@ public class MockAdminClient extends AdminClient {
for (Node node : nodes) {
Map<String, LogDirDescription> logDirDescriptionMap = unwrappedResults.get(node.id());
LogDirDescription logDirDescription = logDirDescriptionMap.getOrDefault(partitionLogDirs.get(0), new LogDirDescription(null, new HashMap<>()));
- logDirDescription.replicaInfos().put(new TopicPartition(topicName, topicPartitionInfo.partition()), new ReplicaInfo(0, 0, false));
+ Map<TopicPartition, ReplicaInfo> topicPartitionReplicaInfoMap = new HashMap<>(logDirDescription.replicaInfos());
+ topicPartitionReplicaInfoMap.put(new TopicPartition(topicName, topicPartitionInfo.partition()), new ReplicaInfo(0, 0, false));
+ logDirDescriptionMap.put(partitionLogDirs.get(0), new LogDirDescription(
+ logDirDescription.error(),
+ topicPartitionReplicaInfoMap,
+ logDirDescription.totalBytes().orElse(DescribeLogDirsResponse.UNKNOWN_VOLUME_BYTES),
+ logDirDescription.usableBytes().orElse(DescribeLogDirsResponse.UNKNOWN_VOLUME_BYTES)));
}
}
}