Open
Conversation
chia7712
reviewed
Apr 18, 2026
| TestUtils.waitForCondition( | ||
| () -> { | ||
| try { | ||
| TopicDescription topicDescription = client.describeTopics(List.of(topic)) |
Member
There was a problem hiding this comment.
Could we use listTopics instead of handling UnknownTopicOrPartitionException?
chia7712
reviewed
Apr 20, 2026
| // the last (active) segment has just one message | ||
|
|
||
| def distinctValuesBySegment = log.logSegments.asScala.map(s => s.log.records.asScala.map(record => TestUtils.readString(record.value)).toSet.size).toSeq | ||
| def distinctValuesBySegment = log.logSegments.asScala.map(s => s.log.records.asScala.map(record => LogTestUtils.readString(record.value)).toSet.size).toSeq |
Member
There was a problem hiding this comment.
def distinctValuesBySegment = log.logSegments.asScala.map(s => s.log.records.asScala.map(record => StandardCharsets.UTF_8.decode(record.value()).toString).toSet.size).toSeq| for (segment <- log.logSegments.asScala; batch <- segment.log.batches.asScala; record <- batch.asScala) { | ||
| assertTrue(record.hasMagic(batch.magic)) | ||
| val value = TestUtils.readString(record.value).toLong | ||
| val value = LogTestUtils.readString(record.value).toLong |
Member
There was a problem hiding this comment.
val value = StandardCharsets.UTF_8.decode(record.value()).toString.toLong| for (logEntry <- records.records.asScala) { | ||
| val offset = logEntry.offset | ||
| val value = TestUtils.readString(logEntry.value).toLong | ||
| val value = LogTestUtils.readString(logEntry.value).toLong |
Member
There was a problem hiding this comment.
val value = StandardCharsets.UTF_8.decode(logEntry.value()).toString.toLong| * @param buffer The buffer to translate | ||
| * @param encoding The encoding to use in translating bytes to characters | ||
| */ | ||
| def readString(buffer: ByteBuffer, encoding: String = Charset.defaultCharset.toString): String = { |
Member
There was a problem hiding this comment.
This looks a bit verbose. Please see my other comments for suggestions on how to remove it.
chia7712
reviewed
Apr 21, 2026
| addedConfigs.put("min.insync.replicas", "2"); | ||
| if (file) { | ||
| File f = kafka.utils.TestUtils.tempPropertiesFile(CollectionConverters.asScala(addedConfigs)); | ||
| File f = tempPropertiesFile(addedConfigs); |
Member
There was a problem hiding this comment.
It could be replaced by ToolsTestUtils#tempPropertiesFile
6a0dfd2 to
8a0997b
Compare
# Conflicts: # tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandTest.java
8a0997b to
c2ccb7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some methods are only used in a single class; they should be moved into
that class. Java tests should not use TestUtils.scala
Reviewers: Chia-Ping Tsai chia7712@gmail.com