Skip to content

Conversation

@DL1231
Copy link
Collaborator

@DL1231 DL1231 commented Dec 31, 2025

Move KRaftClusterTest from core module to server module.
Rewrite

  • testCreateClusterAndRestartControllerNode
  • testSnapshotCount
  • testSingleControllerSingleBrokerCluster
  • testOverlyLargeCreateTopics
  • testTimedOutHeartbeats
  • testRegisteredControllerEndpoints
  • testDirectToControllerCommunicationFailsOnOlderMetadataVersion
  • testStartupWithNonDefaultKControllerDynamicConfiguration
  • testTopicDeletedAndRecreatedWhileBrokerIsDown
  • testAbandonedFutureReplicaRecovered_mainReplicaInOfflineLogDir
  • testAbandonedFutureReplicaRecovered_mainReplicaInOnlineLogDir
  • testControllerFailover
  • testOldBootstrapMetadataFile
  • testIncreaseNumIoThreads

@github-actions github-actions bot added triage PRs from the community core Kafka Broker build Gradle build or GitHub Actions labels Dec 31, 2025
@DL1231 DL1231 requested a review from chia7712 December 31, 2025 09:33
}

// for testing
private[server] def updateCurrentConfig(props: util.Map[_, _]): Unit = {
Copy link
Member

Choose a reason for hiding this comment

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

What is the usage of this method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's used to prevent direct references to KafkaConfig in KRaftClusterTest.

@github-actions github-actions bot removed the triage PRs from the community label Jan 3, 2026
@DL1231 DL1231 requested a review from chia7712 January 6, 2026 01:29
Copy link
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.

@DL1231 thanks for this patch!

controller.shutdown();
// Rewrite The `listeners` config to avoid controller socket server init using different port
var config = controller.sharedServer().controllerConfig().props();
((java.util.HashMap<String, String>) config).put(SocketServerConfigs.LISTENERS_CONFIG,
Copy link
Member

Choose a reason for hiding this comment

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

Map<String, String>

p.toString().substring(log.dir().toString().length()));
if (!p.toString().equals(log.dir().toString())) {
try {
Files.copy(p, out);
Copy link
Member

Choose a reason for hiding this comment

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

assertDoesNotThrow(() -> Files.copy(p, out));

.orElseThrow();
var targetDirFile = new File(targetParentDir, log.dir().getName());
targetDirFile.mkdir();
Files.walk(Paths.get(log.dir().toString())).forEach(p -> {
Copy link
Member

Choose a reason for hiding this comment

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

The Stream returned by Files.walk needs to be closed

var controller = cluster.controllers().values().iterator().next();
controller.controller().waitForReadyBrokers(3).get();
TestUtils.retryOnExceptionWithTimeout(60000, () -> {
var latch = QuorumControllerIntegrationTestUtils.pause((QuorumController) controller.controller());
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of adding an entire dependency for such a minor reference. Maybe we can duplicate a bit of code as a trade-off?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a fair point. I actually considered duplicating the code as well, but it leads to two issues:

  1. We would need to change the visibility of QuorumController#appendControlEvent to public.
  2. We would still need to reference QuorumController, which means the dependency is unavoidable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions core Kafka Broker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants