Skip to content

MINOR: Move CreateTopicsRequestTest to clients-integration-tests and rewrite in Java#22105

Merged
chia7712 merged 2 commits intoapache:trunkfrom
majialoong:move_CreateTopicsRequestTest
Apr 22, 2026
Merged

MINOR: Move CreateTopicsRequestTest to clients-integration-tests and rewrite in Java#22105
chia7712 merged 2 commits intoapache:trunkfrom
majialoong:move_CreateTopicsRequestTest

Conversation

@majialoong
Copy link
Copy Markdown
Contributor

@majialoong majialoong commented Apr 20, 2026

Rewrite CreateTopicsRequestTest in Java and move it from core to
clients-integration-tests.

Reviewers: Ken Huang s7133700@gmail.com, Chia-Ping Tsai
chia7712@gmail.com

@github-actions github-actions Bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) clients labels Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this patch, left some comments

assertFalse(response.errorCounts().keySet().stream().anyMatch(e -> e.code() > 0),
"There should be no errors, found " + response.errorCounts().keySet());

KafkaConfig brokerConfig = cluster.brokers().values().iterator().next().config();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using serverProperties to avoid relying on Scala KafkaConfig?

        int defaultPartitions = defaultNumPartitions(cluster);
        int defaultReplicationFactor = defaultReplicationFactor(cluster);

    private static int defaultNumPartitions(ClusterInstance cluster) {
        return Integer.parseInt(cluster.config().serverProperties()
            .getOrDefault(ServerLogConfigs.NUM_PARTITIONS_CONFIG, "1"));
    }

    private static int defaultReplicationFactor(ClusterInstance cluster) {
        return Integer.parseInt(cluster.config().serverProperties()
            .getOrDefault(ReplicationConfigs.DEFAULT_REPLICATION_FACTOR_CONFIG, "1"));
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out! Scala dependencies should be avoided here. Updated.

* limitations under the License.
*/

package org.apache.kafka.clients.admin;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s a bit odd to place this test in the admin package since it doesn’t use the Admin client.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! Moved to org.apache.kafka.clients.

@github-actions github-actions Bot removed the triage PRs from the community label Apr 22, 2026
Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

assignment.forEach((partitionIndex, brokerIdList) ->
effectiveAssignments.add(new CreatableReplicaAssignment()
.setPartitionIndex(partitionIndex)
.setBrokerIds(new ArrayList<>(brokerIdList))));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use List.copyOf here for better immutability. Let's keep it in mind for next time!

@chia7712 chia7712 merged commit 28402a3 into apache:trunk Apr 22, 2026
26 checks passed
@majialoong majialoong deleted the move_CreateTopicsRequestTest branch April 25, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved clients core Kafka Broker tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants