jsancio commented on code in PR #18240: URL: https://github.com/apache/kafka/pull/18240#discussion_r1917404175
########## raft/src/test/java/org/apache/kafka/raft/RaftClientTestContext.java: ########## @@ -197,9 +198,24 @@ public Builder(OptionalInt localId, Uuid localDirectoryId) { this.localDirectoryId = localDirectoryId; } + public Builder( + ReplicaKey localKey, + VoterSet voters, + KRaftVersion kraftVersion + ) { + this.localId = OptionalInt.of(localKey.id()); + this.localDirectoryId = localKey.directoryId().orElse(ReplicaKey.NO_DIRECTORY_ID); + this.kraftVersion = kraftVersion; + if (kraftVersion == KRaftVersion.KRAFT_VERSION_0) { + withStaticVoters(voters.voterIds()); + } else { + withBootstrapSnapshot(Optional.of(voters)); + } + } Review Comment: I think I miss spoke. How about moving this out of the constructors and adding a configuration method like `withStartingVoter(VoterSet, KRaftVersion)`. The implementation delegates to `withStaticVoters` or `withBootstrapSnapshot`. -- 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