Skip to content

KAFKA-19349: Move CreateTopicsRequestWithPolicyTest to clients-integration-tests #19849

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

Merged
merged 5 commits into from
Jun 2, 2025

Conversation

Rancho-7
Copy link
Contributor

@Rancho-7 Rancho-7 commented May 29, 2025

jira: https://issues.apache.org/jira/browse/KAFKA-19349

Move CreateTopicsRequestWithPolicyTest 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 May 29, 2025
Copy link
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 @Rancho-7 for this patch, left some comments

private void validateErrorCreateTopicsRequests(NewTopic topic, Admin admin, boolean validateOnly, Class<? extends Throwable> expectedExceptionClass, String expectedErrorMessage) {
ExecutionException exception = assertThrows(ExecutionException.class, () ->
admin.createTopics(List.of(topic), new CreateTopicsOptions().validateOnly(validateOnly)).all().get());
assertInstanceOf(expectedExceptionClass, exception.getCause());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you use a stricter check here, use assertEquals instead of assertInstanceOf?

Suggested change
assertInstanceOf(expectedExceptionClass, exception.getCause());
assertEquals(
expectedExceptionClass,
exception.getCause(),
"Expected " + expectedExceptionClass.getSimpleName() + ", but got " + exception.getCause().getSimpleName()
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @m1a2st for the review! I have added the enhanced assertion message to make the output clearer as suggested. However, using assertEquals would require creating a addtional instance which may be unnecessary? since we have already verified the exception type and error message here.

Copy link
Member

Choose a reason for hiding this comment

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

assertInstanceOf allows the subclasses, so it's not a strict check. By contrast, assertEquals(expectedExceptionClass, exception.getCause().getClass()); is a strict check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Thanks @m1a2st @chia7712

@github-actions github-actions bot removed the triage PRs from the community label May 31, 2025
@chia7712 chia7712 merged commit 32903a1 into apache:trunk Jun 2, 2025
24 checks passed
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