Skip to content
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-17574: Allow overriding TestKitNodes baseDirectory #17225

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

srdo
Copy link
Contributor

@srdo srdo commented Sep 18, 2024

This allows shutting down a KafkaClusterTestKit from a JVM shutdown hook without risking error logs because the base directory has already been deleted by the shutdown hook TestUtils.tempDirectory sets up.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Added a test that uses the new method and asserts that the controller and broker metadata directories are inside the specified directory.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

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.

@srdo thanks for your patch. please take a look at following comments. thanks

cluster.nodes().brokerNodes().values().forEach(broker -> {
assertTrue(Paths.get(broker.metadataDirectory()).startsWith(baseDirectory));
});
} catch (Exception e) {
Copy link
Member

Choose a reason for hiding this comment

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

it is find to throw exception directly so could you please remove the catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, this was copied from the test above. Would you prefer I also remove it there?

Copy link
Member

Choose a reason for hiding this comment

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

yes, please do a bit refactor :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Comments should have been addressed in the latest commit

setCombined(true).
setNumControllerNodes(1).build()).build()) {
assertEquals(cluster.nodes().baseDirectory(), baseDirectory.toFile().getAbsolutePath());
cluster.nodes().controllerNodes().values().forEach(controller -> {
Copy link
Member

Choose a reason for hiding this comment

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

please remove unnecessary {}

cluster.nodes().controllerNodes().values().forEach(controller -> {
assertTrue(Paths.get(controller.metadataDirectory()).startsWith(baseDirectory));
});
cluster.nodes().brokerNodes().values().forEach(broker -> {
Copy link
Member

Choose a reason for hiding this comment

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

please remove unnecessary {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

@github-actions github-actions bot added the core Kafka Broker label Sep 23, 2024
@chia7712
Copy link
Member

@srdo Could you please sync trunk?

@srdo
Copy link
Contributor Author

srdo commented Sep 29, 2024

@chia7712 Sure, squashed and rebased to latest.

@chia7712
Copy link
Member

chia7712 commented Oct 7, 2024

@srdo sorry that we have a big refactor for the code. Could you please fix the conflicts again?

@github-actions github-actions bot added the small Small PRs label Oct 7, 2024
@srdo
Copy link
Contributor Author

srdo commented Oct 7, 2024

@chia7712 Sure, done

@chia7712
Copy link
Member

@srdo sorry that could you please fix the conflicts again?

@srdo srdo force-pushed the kafka-17574 branch 2 times, most recently from 06e5ee0 to d38ad47 Compare October 23, 2024 21:06
@srdo
Copy link
Contributor Author

srdo commented Oct 23, 2024

@chia7712 done

@chia7712
Copy link
Member

@srdo could you please rebase code to trigger CI again?

@chia7712
Copy link
Member

I feel the failed tests are unrelated.

This allows shutting down a KafkaClusterTestKit from a JVM shutdown hook
without risking error logs because the base directory has already been
deleted by the shutdown hook TestUtils.tempDirectory sets up.
@srdo
Copy link
Contributor Author

srdo commented Oct 24, 2024

@chia7712 Sure, done.

FWIW ShareConsumerTest passes for me locally.

@chia7712 chia7712 merged commit 98b7e4d into apache:trunk Oct 24, 2024
6 checks passed
abhishekgiri23 pushed a commit to abhishekgiri23/kafka that referenced this pull request Nov 2, 2024
This allows shutting down a KafkaClusterTestKit from a JVM shutdown hook without risking error logs because the base directory has already been deleted by the shutdown hook TestUtils.tempDirectory sets up.

Reviewers: Chia-Ping Tsai <[email protected]>
chiacyu pushed a commit to chiacyu/kafka that referenced this pull request Nov 30, 2024
This allows shutting down a KafkaClusterTestKit from a JVM shutdown hook without risking error logs because the base directory has already been deleted by the shutdown hook TestUtils.tempDirectory sets up.

Reviewers: Chia-Ping Tsai <[email protected]>
tedyu pushed a commit to tedyu/kafka that referenced this pull request Jan 6, 2025
This allows shutting down a KafkaClusterTestKit from a JVM shutdown hook without risking error logs because the base directory has already been deleted by the shutdown hook TestUtils.tempDirectory sets up.

Reviewers: Chia-Ping Tsai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker small Small PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants