-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-17477:Topic command integration test migrate to new test infra #16127
Conversation
3ced55a
to
fff462f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu thanks for this patch
@TaiJuWu please rebase code |
2e12dd1
to
4583d28
Compare
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
Old testcase use PLAINTEXT as its protocol, I try to minimize this PR so make TestKit support PLAINTEXT protocol.
488ccce
to
dc6a7af
Compare
@TaiJuWu please take a look at unrelated changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu thanks for your patch
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/kafka/test/junit/RaftClusterInvocationContext.java
Outdated
Show resolved
Hide resolved
395beef
to
d312323
Compare
@TaiJuWu Could you please rebase code to trigger QA again? |
Done. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu thanks for this patch
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I had a quick Look and left few comments
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java
Outdated
Show resolved
Hide resolved
@TaiJuWu Could you please fix the conflicts? |
be62d75
to
f809d4b
Compare
@SuppressWarnings("deprecation") // Added for Scala 2.12 compatibility for usages of JavaConverters | ||
public class TopicCommandIntegrationTest extends kafka.integration.KafkaServerTestHarness implements Logging, RackAwareTest { | ||
@ExtendWith(ClusterTestExtensions.class) | ||
public class TopicCommandIntegrationTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu Could you please rename it to TopicCommandTest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
5c457bd
to
f89cae8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu thanks for your patch
Map<Integer, Integer> partitionCount = new HashMap<>(); | ||
Map<Integer, List<String>> partitionRackMap = new HashMap<>(); | ||
|
||
assignment.entrySet().stream().forEach(entry -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignment.forEach((partitionId, replicaList) -> {
Integer leader = replicaList.get(0);
leaderCount.put(leader, leaderCount.getOrDefault(leader, 0) + 1);
replicaList.forEach(brokerId -> {
partitionCount.put(brokerId, partitionCount.getOrDefault(brokerId, 0) + 1);
String rack;
if (brokerRackMapping.containsKey(brokerId)) {
rack = brokerRackMapping.get(brokerId);
List<String> partitionRackValues = Stream.of(Collections.singletonList(rack), partitionRackMap.getOrDefault(partitionId, Collections.emptyList()))
.flatMap(List::stream)
.collect(Collectors.toList());
partitionRackMap.put(partitionId, partitionRackValues);
} else {
System.err.printf("No mapping found for %s in `brokerRackMapping`%n", brokerId);
}
});
});
Boolean verifyLeaderDistribution, | ||
Boolean verifyReplicasDistribution) { | ||
// always verify that no broker will be assigned for more than one replica | ||
assignment.entrySet().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignment.forEach((key, value1) -> assertEquals(new HashSet<>(value1).size(), value1.size(),
"More than one replica is assigned to same broker for the same partition"));
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
*More detailed description of your change,
aliveBrokers()
forclusterInstance
.*Summary of testing strategy (including rationale)
Committer Checklist (excluded from commit message)