masonyc commented on code in PR #16563: URL: https://github.com/apache/kafka/pull/16563#discussion_r1673181139
########## raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java: ########## @@ -3854,4 +3859,13 @@ private static ReplicaKey replicaKey(int id, boolean withDirectoryId) { Uuid directoryId = withDirectoryId ? Uuid.randomUuid() : ReplicaKey.NO_DIRECTORY_ID; return ReplicaKey.of(id, directoryId); } + + private static Integer getRandomPort() { + int minPort = 1024; + int mockAddressPrefix = 9990; + // Number of nodes we can set up if we got a random number that is maximum in the range + int reservedNumberOfPorts = 50; + int maxPort = 65535 - mockAddressPrefix - reservedNumberOfPorts; + return ThreadLocalRandom.current().nextInt((maxPort - minPort) + 1) + minPort; + } Review Comment: renamed and removed the minPort so it can generate from 0. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org